为什么我的布局OnItemClickListener不是现在的工作? [英] Why my layout OnItemClickListener not working now?

查看:100
本文介绍了为什么我的布局OnItemClickListener不是现在的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,搞清楚前面问题布局问题,现在我的OnItemClickListener和ItemLongClickListener(文本菜单)已经停止工作了。只需TextView的正常工作

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"
      android:layout_alignParentRight="true"
      android:layout_alignParentBottom="true"
      > 
    </RadioButton> 

</RelativeLayout>

任何人有任何想法,为什么会停止工作?

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

感谢

推荐答案

这些行添加到您的单选按钮布局:

Add these lines to your RadioButton Layout:

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

这将prevent按钮采取的焦点,因此使得OnItemClickListener工作

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

这篇关于为什么我的布局OnItemClickListener不是现在的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆