2012-04-02 27 views
1

ユーザーが購読または購読解除できる一連のキューを含むカスタムListViewが必要です。私のリストビューの各項目は、TextViewとスイッチを含むRelativeLayoutで構成されていなければなりません。このリストを作成するにはどうすればいいですか? 。各アイテムのSwitchとTextViewを使用したカスタムListView

私は各JSONオブジェクトはこのユーザがキューに加入しているか否かの名前と文字列値を有する(JSONオブジェクトの配列を有する:

  • qInfo [i]が(.optString "名前")私のTextViewのテキストを設定する必要があり

  • qInfo [i]が( "値" .optString)私のスイッチの状態を設定する必要があり

queues_item。。:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<RelativeLayout 
    android:id="@+id/queuesLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    > 

    <TextView 
     android:id="@+id/queues_item_text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:text="Medium Text" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <Switch 
     android:id="@+id/queues_item_switch" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:textOn="Tilmeldt" 
     android:textOff="Frameldt"/> 

</RelativeLayout> 

答えて

関連する問題