我怎样才能使ListView控件的排子线性布局不突出的一个被点击的时候 [英] How can I make one of the child linear layout in ListView's row not highlighted when being clicked
问题描述
我用下面的布局我的ListView行的自定义视图。
I use the following layout for my ListView row custom view.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:duplicateParentState="false"
android:clickable="false"
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<!-- A lot of text views -->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:minHeight="48dp" >
<!-- A lot of text views -->
</LinearLayout>
</LinearLayout>
通过使用的android:duplicateParentState =FALSE
和的android:点击=FALSE
,我期待头
被点击列表视图排时的LinearLayout不会被高亮显示。
By using android:duplicateParentState="false"
and android:clickable="false"
, I'm expecting the header
LinearLayout will not be highlighted when the listview row is being clicked.
然而,它仍然被突出显示。我想知道我怎么可以让头
的LinearLayout不突出?
However, it is still being highlighted. May I know how can I make the header
LinearLayout not highlighted?
推荐答案
要删除视觉亮点的一种方法是将的背景绘制到一个标题
StateListDrawable
这对所有有关国家同绘(如纯色),如 STATE_ pressed
并没有
One way to remove the visual highlight is to change header
's background drawable to a StateListDrawable
which has the same drawable (e.g. a solid color) for all relevant states such as state_pressed
and none.
这篇关于我怎样才能使ListView控件的排子线性布局不突出的一个被点击的时候的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!