人。我在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