0

我如何实现以下目标?

预期的实际的

第一张图片显示了我想要达到的结果。第二个是我从布局中得到的当前结果。注意我使用的图像是来自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:handle="@+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>
4

2 回答 2

2

找到它,使用draw9patch工具,将图像宽度设置为屏幕的水平尺寸。 替代文字

于 2010-10-23T14:55:14.843 回答
2

不确定您是否最终将水平宽度硬编码到屏幕中,但我能够通过将 layout_width 设置为 fill_parent 并将 scaleType 设置为 fitXY 来强制 9 补丁水平拉伸(这对于屏幕尺寸更通用)

于 2011-04-15T04:47:31.917 回答