Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android滑动抽屉处理程序';s形象_Android_Image_Handle_Slidingdrawer - Fatal编程技术网

Android滑动抽屉处理程序';s形象

Android滑动抽屉处理程序';s形象,android,image,handle,slidingdrawer,Android,Image,Handle,Slidingdrawer,我想使用我自己的图像作为handler的图像 如何将默认处理程序映像更改为另一个映像? 谢谢 Eyal.将背景图像添加到滑动抽屉按钮。您可以使用图像视图,其中src指向您的图像作为手柄: <SlidingDrawer android:id="@+id/drawer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:handle="@+id

我想使用我自己的图像作为handler的图像

如何将默认处理程序映像更改为另一个映像? 谢谢
Eyal.

将背景图像添加到滑动抽屉按钮。

您可以使用
图像视图
,其中
src
指向您的图像作为手柄:

<SlidingDrawer
     android:id="@+id/drawer"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"

     android:handle="@+id/handle"
     android:content="@+id/content">

     <ImageView
         android:id="@id/handle"
         android:src="@drawable/my_image"
         android:layout_width="wrap_content"
         android:layout_height="fill_parent" />

     ....

</SlidingDrawer>

....

您可能希望将该图像转换为9面片,以便可以拉伸以填充窗口的高度。

您应该为滑块按钮使用选择器,以便可以为不同的状态(聚焦、非聚焦等)生成不同的图像


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