ExpandableListView的子条目不可点击?????

yunmenggyy 2014-09-19 09:15:14
ExpandableListView的子条目中只有两个TextView

<?xml version="1.0" encoding="UTF-8"?>

<!-- 子条目的布局 -->
<LinearLayout
android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/name"
android:textColor="@color/itembig"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>

<TextView
android:id="@+id/number"
android:textColor="@color/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>


</LinearLayout>


网上有人说是因为item里面有可获取焦点的view,可是我在这里及时设置了focusable和Cilckable属性之后,仍然不起作用。子项还是不可点击?????


...全文
124 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yunmenggyy 2014-09-19
  • 打赏
  • 举报
回复
引用 1 楼 zahngzhic 的回复:
你设的什么监听expandableList.setOnChildClickListener();???? 你的 group 可以点 child 不能点?? 看你现在贴的代码 应该不会啊? 实在不行,你自己给 textView 加点击事件 写回调
我刚刚查了一下,是我没有改写下面函数的返回值状态,默认是返回false

		public boolean isChildSelectable(int groupPosition, int childPosition) {
			
			return true;
		}
我写了expandableList.setOnChildClickListener();,并在这个函数里面接收到了点击事件,但是奇怪的是 他不像ListView那样,点击后就有一个反应,这个点击没有任何现象啊
机智蛋蛋 2014-09-19
  • 打赏
  • 举报
回复
你设的什么监听expandableList.setOnChildClickListener();???? 你的 group 可以点 child 不能点?? 看你现在贴的代码 应该不会啊? 实在不行,你自己给 textView 加点击事件 写回调

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧