android - Listview item is not accepting clicks -


i have layout:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:descendantfocusability="blocksdescendants">      <linearlayout         android:orientation="vertical"         android:layout_width="match_parent"         android:layout_height="match_parent">          <textview             android:id="@+id/textviewid"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:visibility="gone"/>          <linearlayout             android:orientation="horizontal"             android:layout_width="match_parent"             android:layout_height="match_parent">              <textview                 android:id="@+id/textviewtext"                 android:layout_margintop="5dp"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:textappearance="?android:attr/textappearancesmall"                 android:singleline="false"                 android:layout_weight="1" />               <imagebutton                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/buttonok"                 android:clickable="true"                 android:focusable="false"/>         </linearlayout>      </linearlayout> </relativelayout> 

the layout used in listfragment. have following code:

@override public void onlistitemclick(listview listview, view view, int position, long id) {     myitem item = items.get(position);      //do something... } 

i have custom adapter , viewholder. listview items not clickable. still didn't code button itself. want able click on whole listview item too.

isn't above correct way it?

in listview , use setonitemclicklistener.

this simplest way of handling click events on listview


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -