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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -