我有线性图层,有两个textview和checkkbox。我想创建自定义视图,并添加此代码几次。我尝试2天,创建自定义视图,但我找不到更复杂的示例示例。只有一个textview,或其他简单的东西。
我的线性层:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="@drawable/border1px"
android:focusable="true"
android:clickable="true"
android:id="@+id/linearxyz"
>
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginLeft="15dip"
android:focusable="false"
android:clickable="false"
>
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Testxyz"
android:textColor="#FF0000"
/>
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Testxyz2"
/>
</RelativeLayout>
<CheckBox
android:id="@+android:id/checkboxxyz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
我想要,使用这个图层,我想要更改textview的文本,更改id图层并添加onclicklistener给他。
答案 0 :(得分:0)
我使用listview,使用适配器,它的工作非常好。谢谢你的帮助
我使用http://javatechig.com/android/android-listview-tutorial/,然后修改我自己的程序。