我想根据Landscape mode
和portrait mode
调整布局。肖像模式和风景模式视图显示调整与手机尺寸
在我的7'平板设备中,portrait mode
太小,Landscape mode
相当大。由于小人像模式,列表项目和一些文本混合像按钮 大小得到减少,一个文本越过另一个,等等。
因此,对于相同的视图布局,我想根据不同的设置模式。
例如考虑这个SO帖子One Layout over the Top of Other。我想要这个场景的portrait mode
。但是对于Landscape mode
,我不希望重叠其中一个视图。相反,我想在另一边看到一种观点。针对不同modes-
<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>
问题
我的XML布局文件,这似乎有利于landscape mode
但是当涉及到肖像模式,我需要news_fragment
得到重叠在channel_fragment
。
如何实现这种行为考虑布局文件是相同的。或者我还必须为肖像创建一个新的?
其实我有2个res /布局文件:'res/layout/activity_main'和'res/layout-large/activity_main'。但前者用于平板设备,后者用于移动设备。我还需要创建2个以上 - 1个用于纵向,1个用于横向?上述有问题的xml适用于平板设备。 –
@SaurabhJain,是的,但是你可以同时拥有多个选项,比如:res/layout-large-land(有一个顺序,不确定这是否正确,但你可以在开发者指南上阅读它) – Warpzit
起初这很让人困惑。你知道平板设备在纵向模式下布局文件的名称吗?还是你有任何文档要看?它是'res/layout-large-port'吗? –