2012-01-23 7 views
1

自分の画像をハンドラーの画像として使用したいと思います。私はonther画像にデフォルトのハンドラの画像を変更するにはどうすればよいAndroid SlidingDrawerハンドラーの画像

enter image description here

?ありがとう、 Eyal。

答えて

2

あなたはハンドルとしてあなたのイメージを指してsrcImageViewを使用することができます。

<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> 

あなたは、おそらくウィンドウの高さを埋めるために延伸することができるので、9patchにその画像を変換したいでしょう。

0

SlidingDrawerのボタンに背景画像を追加します。

1

あなたが異なる状態のために異なるイメージを持つことができるように、あなたはスライダーボタン用のセレクタを使用する必要があります(焦点を当て、非集束など...)

<?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>