Thursday, December 15, 2011

Re: [android-developers] How to assign xml file to Button dynamically?

in xml file we use like this for assigning the xml file to button.
Button
    android:id="@+id/startBtn"
    android:layout_width="130dp"
    android:layout_height="40dp"
    android:layout_marginLeft="190dp"
    android:text="Play"
    android:background="@drawable/transparent">

 </Button>
___________________________________________________________________

But here my intention is
 LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, 0);
 params.topMargin = 0;
                    params.width = 190;
                    params.height = LayoutParams.WRAP_CONTENT;
                    params.gravity = Gravity.RIGHT;
                    bt.setLayoutParams(params);
bt.setBackgroundColor(Color.WHITE);


instead of color i want to use file for tansparency.
Note: here transparent.xml file consists the transparent code..

let me know....




--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment