我想根据Landscape mode
and调整布局portrait mode
。
在我的 7' 平板设备中,portrait mode
它太小而且Landscape mode
很大。由于小型纵向模式,列表项和一些文本混合在一起,例如按钮大小减小,一个文本与另一个文本交叉,等等。
所以对于相同的视图布局,我想根据模式进行不同的设置。
例如,考虑这个 SO 帖子One Layout over the Top of Other。我想要这个场景用于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
。
考虑到布局文件,如何实现这种行为是相同的。还是我也必须为肖像创建新的?