Android-ListView在项目的节标题中禁用按下的效果

Android-ListView在项目的节标题中禁用按下的效果,第1张

概述我有一个带有几个元素和节头的listView.所有项目都有节标题,但仅在必要时显示.这是可能项目的xml代码:<RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:backgro

我有一个带有几个元素和节头的ListVIEw.
所有项目都有节标题,但仅在必要时显示.这是可能项目的xml代码:

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="match_parent"androID:layout_height="wrap_content"androID:background="@drawable/List_selector_transparent"androID:paddingleft="@dimen/padding_small"androID:paddingRight="@dimen/padding_small" ><TextVIEw    androID:ID="@+ID/item_training_section_header"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:layout_alignParenttop="true"    androID:layout_margintop="@dimen/item_training_section_header_margin_top"    androID:background="@drawable/List_selector_transparent"    androID:paddingleft="@dimen/padding_small"    androID:textcolor="@color/item_training_section_header_color"    androID:textSize="@dimen/item_training_section_header_text_size"    androID:textStyle="bold"    androID:visibility="visible" /><relativeLayout    androID:ID="@+ID/item_training_layout"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:layout_below="@ID/item_training_section_header"    androID:background="@drawable/List_selector"    androID:orIEntation="horizontal" >    <ImageVIEw        androID:ID="@+ID/item_training_logo"        androID:layout_wIDth="@dimen/item_training_image_wIDth"        androID:layout_height="@dimen/item_training_image_height"        androID:layout_alignParentleft="true"        androID:layout_centerVertical="true"        androID:layout_margin="@dimen/margin_small"        androID:contentDescription="@string/image_description" />    <TextVIEw        androID:ID="@+ID/item_training_Title_formation"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_centerVertical="true"        androID:layout_margin="@dimen/margin_small"        androID:layout_toRightOf="@ID/item_training_logo"        androID:textcolor="@color/item_training_Title_formation_color"        androID:textSize="@dimen/item_training_Title_formation_text_size" /></relativeLayout>

我尝试使用“ androID:clickable”和“ androID:descendantFocusability”进行多种 *** 作,但没有任何效果.你有什么主意吗 ?
感谢您的回复?

解决方法:

因此,我找到了解决方案.这很简单,但是我不确定为什么:

我只在部分标题为true的位置插入了clickable参数:

androID:clickable="true"

这是所有项目:

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="match_parent"androID:layout_height="wrap_content"androID:paddingleft="@dimen/padding_small"androID:paddingRight="@dimen/padding_small" ><TextVIEw    androID:ID="@+ID/item_training_section_header"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:layout_alignParenttop="true"    androID:clickable="true"    androID:layout_margintop="@dimen/item_training_section_header_margin_top"    androID:paddingleft="@dimen/padding_small"    androID:textcolor="@color/item_training_section_header_color"    androID:textSize="@dimen/item_training_section_header_text_size"    androID:textStyle="bold"    androID:visibility="visible" /><relativeLayout    androID:ID="@+ID/item_training_layout"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:layout_below="@ID/item_training_section_header"    androID:background="@drawable/List_selector"    androID:orIEntation="horizontal" >    <ImageVIEw        androID:ID="@+ID/item_training_logo"        androID:layout_wIDth="@dimen/item_training_image_wIDth"        androID:layout_height="@dimen/item_training_image_height"        androID:layout_alignParentleft="true"        androID:layout_centerVertical="true"        androID:layout_margin="@dimen/margin_small"        androID:contentDescription="@string/image_description" />    <TextVIEw        androID:ID="@+ID/item_training_Title_formation"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_centerVertical="true"        androID:layout_margin="@dimen/margin_small"        androID:layout_toRightOf="@ID/item_training_logo"        androID:textcolor="@color/item_training_Title_formation_color"        androID:textSize="@dimen/item_training_Title_formation_text_size" /></relativeLayout>

有人可以解释这个解决方案吗?

总结

以上是内存溢出为你收集整理的Android-ListView在项目的节标题中禁用按下的效果全部内容,希望文章能够帮你解决Android-ListView在项目的节标题中禁用按下的效果所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1085987.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存