style="?android:attr/starStyle"
このコードをチェックボックス属性に適用した後、チェックボックスを表示できません。コードにエラーはありますか?
style="?android:attr/starStyle"
このコードをチェックボックス属性に適用した後、チェックボックスを表示できません。コードにエラーはありますか?
完全なxmlファイルを投稿します。それは私のために働いています:
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/starStyle"
android:text="CheckBox"
/>
以下のコードを確認してください...
チェックボックスが配置されているレイアウトファイルで...
<CheckBox
android:id="@+id/Check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp"
android:text=" Not connected "
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#ccc"
android:clickable="true"
android:focusable="true"
android:button="@drawable/check"/>
R/drawable/check.xml で - 私の画像の代わりにここで星の画像を使用してください。
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:state_window_focused="true"
android:state_enabled="true"
android:drawable="@drawable/check_on" />
<item
android:state_checked="false"
android:state_window_focused="true"
android:state_enabled="true"
android:drawable="@drawable/check_off" />
</selector>