我想讓這個佈局佔據我的三星Galaxy Tab 10.1上的整個屏幕,其屏幕尺寸大約爲800x1280。Android佈局 - 爲什麼RelativeLayout不能在平板電腦上佔用整個屏幕?
我在res/layout-hdpi和res/layout中有以下xml,而我的@ drawable/background在res/drawable和res/drawable-hdpi中hdpi中的背景圖像是800x1280大小。
但是,當我渲染以下,我無法讓它佔用整個屏幕。我試圖擺脫ScrollView,將relativelayout更改爲linearlayout並將其設置爲layout_height =「match_parent」,但沒有任何更改...我嘗試清理項目,在重新加載之前從設備中卸載應用程序...似乎沒有任何工作。請有人解釋發生了什麼?我想我錯過了一些非常重要的事情。
(注意:這正常工作對我的Kindle Fire和7" 平板電腦在屏幕尺寸是600x1024 ISH)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/background">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/game_relativelayout_top_textview_definition_and_example"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/game_screen_image_box"
android:id="@+id/game_linearlayout_top_textview_definition_and_example"
android:orientation="vertical"
>
<TextView
android:id="@+id/game_textview_definition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_double"
android:layout_marginLeft="@dimen/padding_quadruple"
android:layout_marginRight="@dimen/padding_quadruple"
android:gravity="center_horizontal"
android:textSize="@dimen/font_size_slight_larger"
android:textColor="@android:color/black"
android:text="@string/filler" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_double"
android:src="@drawable/details_page_screen_divider"
android:contentDescription="@string/filler" />
<TextView
android:id="@+id/game_textview_example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_double"
android:layout_marginLeft="@dimen/padding_quadruple"
android:layout_marginRight="@dimen/padding_quadruple"
android:gravity="center_horizontal"
android:textSize="@dimen/font_size_slight_larger"
android:textStyle="italic"
android:textColor="@android:color/black"
android:text="@string/filler" />
</LinearLayout>
<ImageView
android:id="@+id/game_imageview_thumbs_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="@dimen/padding_quadruple"
android:layout_marginBottom="@dimen/padding_quadruple"
android:src="@drawable/game_screen_image_thumbs_down"
android:contentDescription="@string/filler"
/>
<ImageView
android:id="@+id/game_imageview_thumbs_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/game_imageview_thumbs_down"
android:layout_alignParentBottom="true"
android:layout_marginRight="@dimen/padding_double"
android:layout_marginBottom="@dimen/padding_quadruple"
android:src="@drawable/game_screen_image_thumbs_up"
android:contentDescription="@string/filler"
/>
</RelativeLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/game_imageview_timer_foreground"
android:src="@drawable/game_screen_image_timer_foreground"
android:contentDescription="@string/filler"
android:layout_below="@id/game_relativelayout_top_textview_definition_and_example"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/game_imageview_timer_background"
android:src="@drawable/game_screen_image_timer_background"
android:contentDescription="@string/filler"
android:layout_below="@id/game_relativelayout_top_textview_definition_and_example"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@id/game_imageview_timer_foreground"
android:layout_marginTop="@dimen/padding_single">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/game_button_answer_choice_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="@dimen/font_size_regular"
android:text="@string/filler"
android:background="@drawable/game_screen_button_top_left"/>
<Button
android:id="@+id/game_button_answer_choice_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="@dimen/font_size_regular"
android:text="@string/filler"
android:background="@drawable/game_screen_button_top_right"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/game_button_answer_choice_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="@dimen/font_size_regular"
android:text="@string/filler"
android:background="@drawable/game_screen_button_bottom_left"/>
<Button
android:id="@+id/game_button_answer_choice_4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="@dimen/font_size_regular"
android:text="@string/filler"
android:background="@drawable/game_screen_button_bottom_right"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
是的,我沒有完全聽清楚,我完全忘記了我把它當作包裝內容(當我使用10時,它並沒有佔用整個屏幕英寸平板電腦)。謝謝! –