开发者

Android OnItemClick listener Not Working in ListView?

开发者 https://www.devze.com 2023-04-12 00:08 出处:网络
I am developing an application with list-view, which consists of check box as well as Rating bar, here my problem is while i am clicking on arrow button or on listview on item click listener is not wo

I am developing an application with list-view, which consists of check box as well as Rating bar, here my problem is while i am clicking on arrow button or on listview on item click listener is not working for me? any one can help me i am trying for longtime........

Android OnItemClick listener Not Working in ListView?

ListView lv = getListView(); 
lv.setOnItemClickListener(new OnItemClickListener() 
{ 
 @Override 
 public void onItemClick(AdapterView<?> arg0, View arg1,int position, lon开发者_JAVA百科g arg3) 
  { 
  Toast.makeText(SuggestionActivity.this, "" + position, Toast.LENGTH_SHORT).show(); 
  } 
  }); 
  } 


use this

ListView lv = getListView();

lv.setOnItemClickListener(new OnItemClickListener() {
   public void onItemClick(AdapterView<?> parent, View v,int position, long id) {

   });
}


This is because of your layout items. Try to disable the clickability of them using these:

 android:focusable="false"
    android:focusableInTouchMode="false"
0

精彩评论

暂无评论...
验证码 换一张
取 消