12

I am using 2.1 android version. I was creating a check box and I saw something Strange with checkbox. When I put android:padding="5dp" the check box shown as

enter image description here

But the text should be shown next to checkbox. When I remove padding Its looks fine. Is that mean it is a bug or I am taking it in a wrong sense?

<CheckBox
        android:id="@+id/checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginLeft="10dp"
        android:padding="5dp"
        android:text="Select the checkbox"
        android:textColor="@color/black" />
Caner
  • 57,267
  • 35
  • 174
  • 180
Arslan Anwar
  • 18,746
  • 19
  • 76
  • 105

2 Answers2

5

It's more of a bad implementation on Google's part. The answer to this question will have your solution: Android - Spacing between CheckBox and text

Community
  • 1
  • 1
Jason Robinson
  • 31,005
  • 19
  • 77
  • 131
  • 1
    Thanks , I read that link in details and got my pint. It's really bad as Google leave such a unexpected behaviors for us. – Arslan Anwar Dec 01 '11 at 20:28
0

Instead of

android:layout_gravity="left"

you can try

android:gravity="center"

It did the work for me.

zstart
  • 19
  • 2
  • 7