Here is a CheckBox (with no text) defined (within a LinearLayout with
weightSum=100) as follows:
<CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_weight="25"
android:padding="5dp"
android:button="@android:drawable/btn_star"/>
Unfortunately, the button appears to the left (as opposed to the
center) of its LinearLayout box.
Setting android:gravity doesn't make a difference, nor anything else I
could think of. It seems the CheckBox is filling the available width
and left-aligning the button image.
I assume this is something to do with the fact that CheckBox-es
usually have text to the right of the image?
Here is a workaround:
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="25" android:layout_gravity="center">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" android:padding="5dp"
android:button="@android:drawable/btn_star"/>
</FrameLayout>
Is there a nicer workaround?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en