人。我在Activity中使用了RelativeLayout作为头部,并且我希望它具有9.png作为背景绘制。 这里是绘制:9patch可绘制为RelativeLayout背景问题
我得到什么:
正如你所看到的 - 有多余的空间。
这里我使用RGB颜色作为研究背景(和我多么希望它看起来9patch):
难道我做一些有趣的事情,或者是正常的9patch的样子吗?
代码为
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="@+id/relativeTop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
<--THIS IS IT-->
android:background="@drawable/cap">
<--THIS IS IT-->
<Button
android:id="@+id/btnSearchMainReset"
android:text="@string/btnSearchMainReset_text"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/relativeTop">
<RelativeLayout
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:layout_below="@id/relativeTop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF">
<Button
android:id="@+id/btnSearchMainSearch"
android:text="@string/btnSearchMainSearch_text"
android:textSize="20sp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:width="200dp"
/>
<RelativeLayout
android:id="@+id/relativeMain"
android:layout_below="@id/btnSearchMainSearch"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<-- MULTIPLE VIEWS HERE -->
</RelativeLayout>
<Button
android:id="@+id/btnSearchMainSearchLow"
android:text="@string/btnSearchMainSearch_text"
android:textSize="20sp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@@id/relativeMain"
android:width="200dp"
/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
后从您的布局XML – FoamyGuy 2011-05-13 16:33:23
这是蒂姆的代码。 – 2011-05-13 16:46:11
布局看起来不错。我肯定认为这是NinePatch的问题。 – OcuS 2011-05-13 16:46:56