Divick Kishore wrote:
> Hi,
>     I am having a weired problem when I my Buttons are too small. I
> see an additional rectangle / boundary around my button and the shape
> of button is also really weird. Please find the attached image to see
> what I mean.
>
> Please let me know if I need to provide any additional detail, but I
> am not doing anything special except placing the buttons
> programatically in a linear layout defined in one of my xml layout
> files. The linear layout and code snippet for adding button looks
> something like what is shown below:
>
>     <LinearLayout android:id="@+id/leftframe"
>       android:orientation="vertical"
>       android:layout_width="wrap_content"
>         android:layout_height="fill_parent"
>         android:text="Left"
>               android:layout_below="@id/topframe"
>               android:padding="1dip"
>     />
>
> for(int i=0; i< 15; i++)
> {
>               Button b = new Button(this);
>
>               SpannedString s = new
> SpannedString(Html.fromHtml(this.getResources().getString(R.string.alphabet_a)));
>               b.setLayoutParams(new
> LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
>                                      LayoutParams.WRAP_CONTENT, 1));
>               b.setText(s);
>               b.setPadding(0, 0, 0, 0);
>               b.setHeight(0);
>               b.setGravity(Gravity.CENTER);
>
>               b.setTextSize(10.0f);
>               leftFrame.addView(b);
> }
>
>
> Any suggestions on how can I go about fixing this are most welcome,
> Thanks in advance,
> Divkis
>
>

add:

b.setBackgroundResource(id)

where id is a resource idefining your custom Button background
drawable

see btn_default.xml in your sdk installation

pskunk

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to