我有我的佈局問題,這是我的佈局代碼:Android的佈局工作不正常
<?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"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/Scroll"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TableLayout
android:id="@+id/Table"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TableLayout>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<ImageView
android:id="@+id/BookingStatus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/BookingBtn"
android:src="@drawable/statusbarcomplete"/>
<Button
android:id="@+id/BookingBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/Red"
android:text="Place My Booking"
android:textAllCaps="true"
android:textColor="@color/White"
android:textStyle="bold"/>
</RelativeLayout>
</RelativeLayout>
這裏是如何看起來小設備上:
這裏它是如何看起來在一個大型設備上
現在,你可以看到問題是與小設備,按鈕和圖像似乎「漂浮」在佈局的頂部,而我希望他們在buttom的在任何時候的佈局。因此,用戶需要在小型設備上滾動,但底部的圖像和按鈕始終處於底部並始終可見!滾動視圖將佔用屏幕的其餘部分,以便用戶可以看到信息。
您可以查看XML文件here完整的代碼。我刪除了所有的表格,以保持這個線程整潔,因爲代碼是超過300行
您可以滾動視圖分配佈局,高度值... – micky 2014-09-03 10:16:54
你需要遵循http://developer.android.com/training/multiscreen/screensizes.html和我在我的情況做了我犯了一個具體的佈局-mdpi,layout-xhdpi等res中和運行時的特定目錄,佈局將根據屏幕的大小顯示。注意*僅將那些受到干擾的佈局添加到這些目錄 – 2014-09-03 10:21:53
佈局-height永遠不會工作,它只會對特定的分辨率有用嗎? – apmartin1991 2014-09-03 10:23:04