是否可以製作由多個圖像/比例/對齊組成的xml背景? 所以有一個複雜的可繪製xml可用作android佈局的背景。Android - xml佈局作爲背景
例如,這是動態XML背景下,我想這樣做:
所以,我的所有不同的活動,把我上面不同的佈局/視圖:
我知道我不能設置一個佈局爲layout_background,但這裏是我想(根據以前的照片)做設計:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_image" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/main_image" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/footer_image" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
我看到我們可以將位圖設置爲可繪製的xml,但是對於scale和alignement? 有沒有更簡單的方法來進行這種視覺渲染?
我認爲另一個相對佈局代替父線性佈局效果更好。 – FabiF 2013-03-19 14:47:15
是的,你是對的@FabiF我編輯了我的答案 – 2013-03-19 14:51:39
完美!非常感謝! RelativeLayout是線索:) – Bibix 2013-03-19 15:07:37