I have a popup in my page which has a listview. I have created design of popup in a seperate xml and loading it on some button click in my main page. The popup has a listview with each row having a image and a textview. I am not able to get row selection in listview in android 4.1 but it is working in 5.0. Can anyone please suggest me the solution? Listview:
<ListView android:id="@+id/lstSites"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fastScrollEnabled="true"
android:layout_margin="5dp"
android:descendantFocusability="blocksDescendants"></ListView>
</LinearLayout>
Listview Item:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false">
<ImageView
android:id="@+id/thumbImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:focusable="false"
android:focusableInTouchMode="false"/>
<TextView
android:id="@+id/tvSite"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Name"
android:focusable="false"
android:focusableInTouchMode="false"/>
adding row click listner:
lstSiteMenu = (ListView) popupView.findViewById(R.id.lstSites);
adapter = new MenuItemsAdapter(SiteActivity.this, arrMenu);
// Attach the adapter to a ListView
lstSiteMenu.setAdapter(adapter);
lstSiteMenu.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
final int position, long id) {
}
android:descendantFocusability="blocksDescendants"
fromListView
. – Brede