当手机处于肖像模式时,它会在顶部和底部显示标题和图片,其中包含按钮和注释。但是,当我将手机设为横向模式时,按钮和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 –
好吧,欢呼声。这给了我足够的工作。我很欣赏你提供的解释。 –