开发者

Why my layout OnItemClickListener not working now?

开发者 https://www.devze.com 2022-12-16 18:46 出处:网络
Ok, after figuring out the earlier question \'Layout Question\', now my OnItemClickListener, and ItemLongClickListener(ContextMenu) have stopped working. With just the TextView it works fine

Ok, after figuring out the earlier question 'Layout Question', now my OnItemClickListener, and ItemLongClickListener(ContextMenu) have stopped working. With just the TextView it works fine

xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout  
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content">

    <TextView 
      android:id="@+id/txtVehName" 
      android:hint="@string/VEH_NAME" 
      android:textSize="18dp" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:layout_marginTop="10dip"
      android:layout_alignParentBottom="true"
      > 
    </TextView>

    <RadioButton 
      android:id="@+id/rbDefault" 
      android:text="" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"
      and开发者_JAVA技巧roid:layout_alignParentRight="true"
      android:layout_alignParentBottom="true"
      > 
    </RadioButton> 

</RelativeLayout>

Anyone have any ideas as to why this would stop working?

thanks


Add these lines to your RadioButton Layout:

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

This will prevent the button from taking focus, therefore making the OnItemClickListener work

0

精彩评论

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