所以我main.xml中看起來像這樣:安卓:layout_weight認爲在FrameLayout裏的嵌入式圖像瀏覽器的大小
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1">
<FrameLayout
android:id="@+id/headerFrameLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.15"
android:background="#597eAA">
<ImageView
android:id="@+id/logoImage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#7ba1d1"
android:src="@drawable/logo_conekta"/>
</FrameLayout>
<LinearLayout
android:id="@+id/bodyLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="#f3f3f3"
android:orientation="horizontal" >
</LinearLayout>
<FrameLayout
android:id="@+id/footerFrameLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.15"
android:background="#597eAA" >
</FrameLayout>
我試圖完成是有屏幕分爲三個:高度相同的頁眉和頁腳,以及其餘的頁面。
當我運行此代碼時,headerFrameLayout最終成爲footerFrameLayout + logoImage的高度。例如:headerFrameLayout = 163,logoImage = 58,footerFrameLayout = 105和bodyLinearLayout = 493。
我不明白爲什麼標題也考慮照片的大小。有任何想法嗎?