我怎样才能使ListView控件的排子线性布局不突出的一个被点击的时候 [英] How can I make one of the child linear layout in ListView's row not highlighted when being clicked

查看:179
本文介绍了我怎样才能使ListView控件的排子线性布局不突出的一个被点击的时候的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的布局我的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屋!

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