【发布时间】:2013-06-09 12:14:23
【问题描述】:
我想根据Landscape mode和portrait mode调整布局。
在我的 7' 平板设备中,portrait mode 太小,Landscape mode 相当大。由于小人像模式,列表项和一些文本像按钮一样混合
尺寸变小了,一个文本与另一个文本交叉,等等。
所以对于相同的视图布局,我想根据模式有不同的设置。
例如,考虑One Layout over the Top of Other 的这个 SO 帖子。我想要portrait mode 的这种情况。但是对于Landscape mode,我不希望一个视图重叠 在另一个视图之上。相反,我希望在另一侧看到一个视图。
我的不同模式的xml布局文件-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/news_fragment"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/channel_fragment"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
问题是这对landscape mode 来说似乎很好,但在纵向模式下,我需要news_fragment 与channel_fragment 重叠。
考虑到布局文件是相同的,如何实现这种行为。还是我也必须为肖像创建一个新的?
【问题讨论】:
标签: android layout landscape-portrait