我想在一行中创建一个自定义列表视图,其中包含两个TextViews和一个单选按钮。并在listitem上单击单选按钮状态应该切换。我无法在这里使用简单适配器。自定义单选列表查看
我已经问过这个问题Single choice ListView custom Row Layout,但没有找到任何满意的解决方案。
我现在在做的是我正在使用simple_list_item_single_choice并将两个TextView的数据放在一个由一些空白分隔的单独的数据中。但在这里变得更糟(如下图所示)。
我要的是解决规模和价格的位置,使列表视图为单一选择。该列表
XML布局可以是这样的:
**<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="15sp"
android:width="200dp" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="15sp"
android:width="70dp" />
<RadioButton
android:id="@+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>**
如何让自定义适配器是什么?
检查out this tutorial http://www.vogella.de/articles/AndroidListView/article.html –
你可以在[GitHub](https://github.com/CabezasGonzalezJavier/NotifyDataSetChanged) – Cabezas
检查这个以备将来参考** https://www.youtube.com/watch?v = s4JwU28VMko ** –