分享

发现ExpandableListActivity的onChildClick方法失效

 Python进阶者 2023-02-10 发布于广东

通过继承ExpandableListActivity实现了一个二级列表,而子列表存在TextView和CheckBox组件,这里就存在一个问题,点击子列表项发现onChildClick方法并没有调用,搜索才发现是CheckBox的ListView失去焦点了。最后通过把CheckBox的焦点给释放了android:focusable="false"就可以了。
方法如下:

  1.   <CheckBox

  2. android:layout_width="match_parent"

  3. android:layout_height="18dp"

  4. android:id="@+id/caculated"

  5. android:layout_weight="27"

  6. android:checked="true"

  7. android:textColor="@color/colorScorexml"

  8. android:focusable="false"

  9. />

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多