据我所知,ListView嵌入CheckedTextView形成列表,但每个CheckedTextView只有一个TextView和一个CheckBox。我想要做的是向 CheckedTextView 添加一些 TextView,如下所示:
文本视图 | 文本视图 | 文本视图 | 复选框| ---- CheckedTextView
如何自定义 CheckedTextView?任何帮助将不胜感激!</p>
据我所知,ListView嵌入CheckedTextView形成列表,但每个CheckedTextView只有一个TextView和一个CheckBox。我想要做的是向 CheckedTextView 添加一些 TextView,如下所示:
如何自定义 CheckedTextView?任何帮助将不胜感激!</p>
为此,您需要创建一个LinearLayout
实现的自定义,并使用该自定义Checkable
创建您的自定义,它将作为. 是一个很好的教程,用一个例子来解释。row.xml
LinearLayout
Checkable
Here
我建议为您的 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。