Android中的列表视图项布局

Android中的列表视图项布局,android,listview,android-layout,clickable,Android,Listview,Android Layout,Clickable,我试图设置右箭头的背景,当我按下它时,只有箭头周围的背景才会显示(直到分隔符) 我试着用图像按钮,但当我这样做时,列表项不能被点击 这是我的XML项目列表布局: xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom=

我试图设置右箭头的背景,当我按下它时,只有箭头周围的背景才会显示(直到分隔符)

我试着用图像按钮,但当我这样做时,列表项不能被点击

这是我的XML项目列表布局:

    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="5dip"
    android:paddingLeft="2dip"
    android:paddingRight="2dip"
    android:paddingTop="5dip" >

    <ImageView
        android:id="@+id/itemlist_checkedd"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:adjustViewBounds="true"
        android:src="@drawable/ic_checkitem" />


    <ImageView
        android:id="@+id/skinpreview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@id/itemlist_checkedd"
        android:scaleType="fitXY" />

   <ImageButton
        android:id="@+id/skinEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:adjustViewBounds="true"
        android:paddingLeft="10dip"
        android:background="@null"
        android:src="@drawable/ic_go_edit" />

    <ImageView 
        android:id="@+id/separator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@id/skinEdit"
        android:layout_marginRight="5dip"
        android:src="@drawable/separator"/>

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="2dip"
        android:layout_marginRight="15dip"
        android:layout_toRightOf="@id/skinpreview"
        android:layout_toLeftOf="@id/separator"
        android:textAppearance="?android:attr/textAppearanceLarge" />
xmlns:android=”http://schemas.android.com/apk/res/android"
android:layout\u width=“fill\u parent”
android:layout\u height=“包装内容”
android:paddingBottom=“5dip”
android:paddingLeft=“2dip”
android:paddingRight=“2dip”
android:paddingTop=“5dip”>
这就是它的样子:

有什么建议吗???
谢谢。

只需在此xml中设置父视图的背景色或图像

在res/drawable中创建选择器xml文件

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
     android:state_pressed="true"
     android:drawable="@drawable/arrow_pressed" />
    <item
     android:state_pressed="false"
     android:drawable="@drawable/arrow" />
</selector>

您将需要创建另一张带有所需高亮背景的箭头图片


当然,然后将ImageView src分配给xml文件(arrow_selector.xml),例如

谢谢您的回答。另一个问题,我如何只拉伸“按箭头”的图像,这将适合整个右侧区域直到分隔图像?只需在photoshop中为按箭头(大/小/蓝/拉伸)创建所需的任何图像,如果您是指其他内容,您可以在代码中声明图像,ImageView arrow=(ImageView)findViewById(R.id.arrow);然后使用箭头上的函数处理该图像的xml属性,并在onClick()函数中执行此操作。