开发者

SlidingDrawer using a 9 patch handle image

How do I achieve the following?

SlidingDrawer using a 9 patch handle image

SlidingDrawer using a 9 patch handle image

The first image shows the result I want to achieve. The second one is the current result I'm getting from my layout. Note The image I'm using is the one from android 1.6 jar.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
 <SlidingDrawer
    android:id="@+id/drawer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:h开发者_StackOverflowandle="@+id/handle"
    android:content="@+id/content">

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

 <Button
    android:id="@id/content"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Button" />
 </SlidingDrawer>
</LinearLayout>


Found it, used the draw9patch tool and set the image width to the horizontal size of the screen.

SlidingDrawer using a 9 patch handle image


Not sure if you ended up hardcoding the horizontal width into the screen, but I was able to force the 9 patch to stretch horizontally by setting the layout_width to fill_parent and scaleType to fitXY (which is more generic for screen sizes)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜