2

私の知る限り、ListView には CheckedTextView が埋め込まれてリストが形成されますが、すべての CheckedTextView には TextView と CheckBox が 1 つしかありません。私がやりたいことは、次のように、いくつかの TextView を CheckedTextView に追加することです。


テキストビュー | テキストビュー | テキストビュー | チェックボックス| ---- CheckedTextView


CheckedTextView をカスタマイズするには? どんな助けでも大歓迎です!</p>

4

2 に答える 2

8

LinearLayoutそのためには、実装するカスタムを作成し、そのカスタムを使用してCheckable作成する必要があります。例で同じことを説明する素晴らしいチュートリアルです。row.xmlLinearLayoutCheckableHere

于 2012-08-21T05:11:39.953 に答える
1

おそらく、ListView のカスタム レイアウトを作成することをお勧めします。

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

    <TextView
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/text3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <CheckBox 
        android:id="@+id/checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

このレイアウトに個性を与えるために時間をかけてください。SimpleAdapterまたはSimpleCursorAdapterを使用して、一意の文字列を各 TextView にバインドできるようになりました。

于 2012-08-21T05:08:10.830 に答える