列表视图中选定列表项上的Android左边框
我正在尝试做一些类似Wordpress Android应用程序的事情: 我在导航抽屉中有一个列表视图。当使用选择器资源选择项目时,我设法使背景发生变化。如何在所选项目的左侧制作一个小的彩色矩形?比如wordpress应用程序 编辑: 我的列表项布局:列表视图中选定列表项上的Android左边框,android,android-listview,Android,Android Listview,我正在尝试做一些类似Wordpress Android应用程序的事情: 我在导航抽屉中有一个列表视图。当使用选择器资源选择项目时,我设法使背景发生变化。如何在所选项目的左侧制作一个小的彩色矩形?比如wordpress应用程序 编辑: 我的列表项布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/drawer_background_selector"
android:orientation="horizontal" >
<ImageView
android:id="@+id/drawer_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp" />
<TextView
android:id="@+id/drawer_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="8dp" />
</LinearLayout>
我的选择器:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/drawer_selected" android:state_activated="true"/>
<item android:drawable="@color/drawer_selected" android:state_selected="true"/>
<item android:drawable="@color/drawer_selected" android:state_pressed="true"/>
<item android:drawable="@color/drawer"/>
</selector>
您可以使用图层列表,如下所示:
你可以,也可以创建一个9补丁的图像来跳过透支,但它是不可阻挡的,所以我不会去那里 您可以使用图层列表,如下所示:
你可以,也可以创建一个9补丁的图像来跳过透支,但它是不可阻挡的,所以我不会去那里 您可以使用图层列表,如下所示:
你可以,也可以创建一个9补丁的图像来跳过透支,但它是不可阻挡的,所以我不会去那里 您可以使用图层列表,如下所示:
你可以,也可以创建一个9补丁的图像来跳过透支,但它是不可阻挡的,所以我不会去那里 使用
使用
使用
使用
您可以发布选择器xml和资源吗?请查看该页面:以及用于创建所需可绘制文件的形状资源。您可以发布选择器xml和资源吗?请查看该页面:以及用于创建所需可绘制文件的形状资源。您可以发布选择器xml和资源吗?请查看该页面:以及用于创建所需可绘制图形的形状资源。能否发布选择器xml和资源?请查看该页面:以及用于创建所需可绘制图形的形状资源。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@color/drawer_selected" />
<item
android:drawable="@color/rectangle_color"
android:left="10dp"/>
</layer-list>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="LEFT COLOR HERE"/>
</shape>
</item>
<item android:left="5dip">
<shape android:shape="rectangle">
<solid android:color="RIGHT COLOR HERE"/>
</shape>
</item>
</layer-list>