-1
私はプレイヤーのリストがあるところで活動しています。リストには、すべてのプレーヤーの名前が含まれています。 「Remove」、「Rate as best」などのオプションを使用して各名前に対してスピナーを提供したい。 リストを作成しましたが、特定のオプションセットを持つスピナーを追加できませんでした。リストビューの各アイテムに対してスピナーを追加するには
マイコードです。
あなたはリストビュー[開く]ダイアログをクリックして、ダイアログの代わりに、スピナーにカスタムレイアウトを添付<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_add_player">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/players_listView"
android:choiceMode="singleChoice"/>
</LinearLayout>
ドゥplayers_name.xmlにスピナーコンポーネントがありますか?そして、デフォルトのアダプタを使用する代わりにcustomAdapterを書き、あなたが望むようにそれを使用します。 – ajantha
このリンクを参照http://stackoverflow.com/questions/15002821/listview-adding-spinner-in-each-row各行にsipnerを追加できます –
LinearLayout内にTextViewとSpinnerを持つレイアウトを作成します(orientation:次に、BaseAdapterを拡張するカスタムアダプターを使用します。今すぐあなたのアダプターでこのレイアウトを膨張させてください。 カスタムアダプターの使用方法をこの例で確認してください。http://androidadapternotifiydatasetchanged.blogspot.in/ – vjamit