0

チェックボックス付きのリストビューがあります。問題は、デバイスとエミュレータで表示されるチェックボックスが異なることです。

エミュレータでの表示は次のとおりです。

ここに画像の説明を入力

そしてそれがデバイス上でどのように見えるか:

ここに画像の説明を入力

デバイスのチェックボックスの右端が切り取られていることがわかります。

これは @drawable/custom_checkbox_design.xml です

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

     <item android:state_checked="true" android:drawable="@drawable/checked" />
     <item android:state_checked="false" android:drawable="@drawable/unchecked" />

</selector>

行のレイアウト:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <CheckBox
        android:id="@+id/ColChk"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="40dp"
        android:button="@drawable/custom_checkbox_design"
        android:layout_gravity="center_vertical|center_horizontal" />

          <TextView
            android:id="@+id/ColOpis"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:minLines="1"
            android:scrollHorizontally="false"
            android:text="Opis"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/ColCode"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Code"
            android:visibility="invisible" />
</LinearLayout>

私が間違っていることは何ですか?エミュレータで正しく表示されるのはなぜですか?

4

2 に答える 2