0
  1. I have a ListViewin my ListView show ImageButton, ImageView, Button, TextView

  2. I set ListView.OnItemClickListner. When I run my project, it shows my ListView.

  3. But when i click on listview it's not working

  4. what is wrong? and I want button, ImageButon,ImageView click events should call Activity or dialog ? Help me?

This is the code:

list.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view,
            int position, long id)
    {
        Toast.makeText(getActivity(), "sdadad",1).show();


    }
});
galath
  • 5,717
  • 10
  • 29
  • 41
  • some of the element in listview row is taking the focus – KOTIOS Jul 29 '15 at 06:33
  • This might help: http://stackoverflow.com/questions/11428303/android-cant-click-on-listview-row-with-imagebutton – Andro Jul 29 '15 at 07:30
  • 1) Why you have a `ListView` inside your `ListView`? You can use `ExpandableListView` for that. -- 2) For your click problem, i guess it's related to `descendantFocusability`. – Rami Jul 29 '15 at 10:20

1 Answers1

0

Add one tag in parent layout of your custom layout

android:descendantFocusability="blocksDescendants"
Siri
  • 143
  • 11