简体   繁体   English

在横向和纵向上显示不同的小部件/视图

[英]Show Different Widgets/Views on Landscape and Portrait

I have 我有

Portrait Mode: - Containing View Pager with 2 Tabs (which contains 2 Fragments both having different views and inflating 2 different layouts. 纵向模式:-包含具有2个选项卡的View Pager(其中包含2个具有不同视图并放大2种不同布局的片段。

Landscape Mode: - Containing View Pager with 3 Tabs (which contains 3 Fragments all having different views and inflating 3 different layouts. 横向模式:-包含带有3个选项卡的View Pager(其中包含3个片段,每个片段具有不同的视图并放大3种不同的布局。

How can I achieve this ? 我该如何实现?

Thanks, 谢谢,

Create a boolean in values-land that is set to true and false in values. values-land中创建一个布尔值,将其values-land设置为true和false

<resources>
    <bool name="is_landscape">false</bool>
</resources>

Depending on the value of this boolean, you can set different Fragments in your adapter. 根据此布尔值的不同,可以在适配器中设置不同的分片。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM