Ich bin neu in Android. Ich möchte mich im Vorhinein besonders bedanken. Das Problem ist, ich benutze horizontale Listenansicht und verwenden Spinner innerhalb der horizontalen Listenansicht Adapter. Es zeigt rechts, aber wenn wir auf Spinner klicken, dann OnItemSelected Listener wird nicht aufgerufen.Spinner arbeitet nicht mit horizontaler lisview
Code unten ist innerhalb der Adapterklasse, die BaseAdapter implemened ist
spinerConfigurableList=(Spinner) row.findViewById(R.id.spinerConfigurableList);
spinerConfigurableList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// spinerConfigurableList.setSelection(position);
configurableSelection=position;//Problem is here,this never invoke.
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
I am following this example https://github.com/MeetMe/Android-HorizontalListView
Xml for adapter.
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/llDrop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
>
<Spinner
android:id="@+id/spinerConfigurableList"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:prompt="@string/app_name"
android:spinnerMode="dropdown"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_margin="1dp"
android:theme="@style/AppThemeForSpinner"
android:textColor="@color/font_color_black_light"
android:textSize="@dimen/font_size_level_two"
></Spinner>
</LinearLayout>
Geben Sie Ihren Code ein. – Jas