我有一个包含以下视图和嵌套相对布局的相对布局。对于某些设备,屏幕底部有一个空白区域。我想将空间公平地分配给嵌套视图并viewgroups()
填充屏幕。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/tdmubiobgd"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MasterActivity$DummySectionFragment" >
<Button
android:id="@+id/ScanButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Scan" />
<ImageView
android:id="@+id/scan_adsView"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_alignLeft="@id/ScanButton"
android:layout_alignParentTop="true"
android:scaleType="fitXY"
android:src="@drawable/ads" />
<RelativeLayout
android:id="@+id/scan_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/scan_adsView"
android:layout_below="@id/scan_adsView"
android:layout_marginTop="10px"
android:orientation="horizontal" >
<ImageView
android:id="@+id/Scan_Image"
android:layout_width="72px"
android:layout_height="72px"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/Scan_Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/Scan_Image"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="@+id/Scan_DName"
android:layout_width="80dip"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView3"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:gravity="right"
android:text="DName "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
android:id="@+id/Scan_Sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/Scan_Name"
android:layout_toRightOf="@+id/Scan_Age"
android:text="Male"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/Scan_Age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/Scan_Sex"
android:layout_alignBottom="@+id/Scan_Sex"
android:layout_alignLeft="@+id/Scan_Name"
android:text="30"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
<ImageView
android:id="@+id/scan_level1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/scan_header"
android:layout_below="@+id/scan_header"
android:scaleType="fitXY"
android:src="@drawable/l1warning" />
<RelativeLayout
android:id="@+id/scan_master"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/scan_level"
android:layout_below="@id/scan_level1"
android:layout_marginTop="10px"
android:orientation="horizontal" >
<TextView
android:id="@+id/scan_mname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MinionRush"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/scan_mdetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/scan_mname"
android:layout_below="@+id/scan_mname"
android:text="DoodlePlay"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/scan_period"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/scan_mdetails"
android:text="DartRace"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="@+id/scan_alarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="20dp"
android:src="@drawable/alarm" />
</RelativeLayout>
<ImageView
android:id="@+id/scan_level2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/scan_master"
android:layout_below="@id/scan_master"
android:scaleType="fitXY"
android:layout_marginTop="10px"
android:src="@drawable/toempty" />
<Gallery
android:id="@+id/scan_gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/scan_level2"
android:layout_marginTop="10px"
android:layout_alignParentLeft="true" />
<ImageView
android:id="@+id/faq"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/scan_gallery"
android:layout_centerHorizontal="true"
android:layout_marginTop="10px"
android:scaleType="fitXY"
android:src="@drawable/faq" />
</RelativeLayout>