1
我正在處理佈局。 temp1包含在temp2中。 temp1工作正常,但是當我將它包含在temp2中時。它填充整個屏幕,因爲temp1中的根被設置爲fill_parent。在這種情況下可能有什麼解決方案?包含佈局在另一個佈局中填充視圖
我想在temp1中心的一個小區域temp2中顯示佈局。
temp1.xml
<RelativeLayout android:layout_height="fill_parent"
android:layout_width="fill_parent">
</RelativeLayout>
temp2.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="@+id/relativeLayout">
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/temp1"/>
</RelativeLayout>
</RelativeLayout>
是的,我意識到這一點,事實證明這是現在唯一的解決方案。謝謝你的回答。我必須給dp做一個尺寸來做我想做的事情。 – VendettaDroid 2013-03-14 22:56:10