Hej,
zastanawiam się jak mogę zmienić domyślny checkbox w androidzie. Chciałbym aby był to po prostu biały kwadrat z zaokrąglonymi lekko rogami. Czy ktoś mi może pomóc?
0
0
http://stackoverflow.com/a/3965796/1387438
plik w katalogu drawable checkbox.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="true">
<shape android:shape="rectangle" >
<corners android:radius="10px"/>
<solid android:color="#ff1000"/>
<size android:width="50px" android:height="50px"/>
</shape>
</item>
<item >
<shape android:shape="rectangle" >
<corners android:radius="10px"/>
<solid android:color="#a0a0a0" />
<size android:width="50px" android:height="50px"/>
</shape>
</item>
</selector>
Przykład layouta:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text=""
android:button="@drawable/checkbox"
android:checked="false"/>
</LinearLayout>