我想在一行中創建一個自定義列表視圖,其中包含兩個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 ** –