當手機處於肖像模式時,它會在頂部和底部顯示標題和圖片,其中包含按鈕和註釋。但是,當我將手機設爲橫向模式時,按鈕和ListView
消失,只顯示標題和圖像。我基本上不能在圖像下面滾動。更改方向將刪除用戶界面元素
還有第三個元素 - 一個TextView
爲身體 - 這也是在ScrollView
:每個佈局將有TextView
內容或圖像。當內容沒有圖像的TextView
發生同樣的事情。當圖像或文字不是佔用整個屏幕時不會發生這種情況。
肖像模式:
風景模式:
伴隨碼:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
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="net.vannevel.redditapp.activities.PostActivity">
<TextView
android:id="@+id/postDetailTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textColor="#000" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/postDetailImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/postDetailBody"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/postDetailViewOnlineButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onViewOnlineButtonClicked"
android:text="View original source" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="COMMENTS" />
<ListView
android:id="@+id/postDetailCommentList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
我想一個單獨的佈局可能實際上是最有意義的。但是,即使在縱向模式下:例如,當文字對於屏幕來說太大時,它將被置於滾動視圖中,從而從屏幕移除其他項目(註釋)。由於它已經是肖像模式,我無法用其他佈局修復此問題。那麼建議的方法是什麼? –
我會選擇#3或在不同的屏幕上顯示註釋。我會盡快更新答案,並提供更多有關選擇的詳細信息#3 –
好吧,歡呼聲。這給了我足夠的工作。我很欣賞你提供的解釋。 –