小编erk*_*kuy的帖子

如何摆脱自定义行列表视图的点击效果?

我正在尝试禁用行上的点击效果。我使用了绑定到 ArrayAdapter 的自定义行。我尝试android:clickable="false", android:focusable="false"过 ListView,也尝试过 TextView、按钮和 imageview,它们用于在行中显示。

这是我的“web_message_list.xml”

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/exclamation_feather_top"
    >

    <RelativeLayout 
    android:id="@+id/titleArea"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:background="@drawable/top_head">


     <ImageView 
         android:id="@+id/btn_Cancel"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/cancel"
         android:layout_marginTop="6dp"
         android:layout_marginLeft="2dp"
         android:layout_alignParentLeft="true"
         android:visibility="gone"

         />   
    <TextView
        android:id="@+id/contact_title"
        style="?customTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentTop="true"
        android:layout_centerInParent="true" 
        android:text="Messages" />  
    <ImageView
        android:id="@+id/edit_btn"
        android:layout_width="65dp"
        android:layout_height="33dp"
        android:layout_marginTop="3dp"
        android:layout_marginRight="2dp"
        android:layout_alignParentRight="true"        
        android:src="@drawable/edit_button"
        android:scaleType="fitEnd" />

    <ImageView
    android:id="@+id/btnDone"
        android:layout_width="65dp"
        android:layout_height="33dp"
        android:layout_marginTop="3dp"
        android:layout_marginRight="2dp"
        android:layout_alignParentRight="true"         
        android:src="@drawable/done_button"
        android:visibility="gone"
        android:scaleType="fitEnd"        />

    </RelativeLayout>


     <ListView
        android:id="@android:id/android:list"
        style="@style/blackContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/titleArea"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="2dp"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false" >
    </ListView>    

</RelativeLayout> …
Run Code Online (Sandbox Code Playgroud)

android android-layout

1
推荐指数
1
解决办法
4831
查看次数

标签 统计

android ×1

android-layout ×1