2

This is my XML for my check box:

<CheckBox
                android:id="@+id/atm_checkbox"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@color/input_color" />

And it looks like this:

http://imageshack.us/photo/my-images/528/47342915.png/

This is what i found on internet:

<CheckBox
        android:id="@+id/chkAndroid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/chk_android"
        android:checked="true" />

which looks like this

how to change my checkbox to look like the one i found on internet. As my rep is <10 i cant upload image of my checkbox, or can anyone help me how to style checkbox to make it look better

I think both the xmls have similar code, but why are they looking so different?

Archie.bpgc
  • 23,812
  • 38
  • 150
  • 226

3 Answers3

1

If you want custom the look of checkbox see this tutorial and find everything.

By the way, the checkbox from your link is for Android3.0 and above.

GAMA
  • 5,958
  • 14
  • 79
  • 126
Trung Nguyen
  • 7,442
  • 2
  • 45
  • 87
0

CheckBox derive from Button class, so you can set a background image like button. See this link, may be it is what you are looking for.

Community
  • 1
  • 1
orchidrudra
  • 1,172
  • 1
  • 12
  • 30
  • using the code in the link given (adding image), gave me a similar checkbox, but instead of a square there is a start now, which is not visible 100%, some 10% of it is cut to the right, is this because i am not using width = "wrap content" ? – Archie.bpgc Jun 15 '12 at 07:11
0

If you want a clean design without codes, use:

<CheckBox
   android:id="@+id/checkBox1"
   android:layout_height="wrap_content"
   android:layout_width="wrap_content"
   android:drawableLeft="@android:color/transparent"
   android:drawablePadding="10dp"
   android:text="CheckBox"/>

The trick is to set colour to transparent for android:drawableLeft and assign a value for android:drawablePadding. Also, transparency allows you to use this technique on any background colour without the side effect - like colour mismatch.

ChuongPham
  • 4,761
  • 8
  • 43
  • 53