Ahmad Ali Nasir
Ahmad Ali Nasir

Reputation: 1392

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.

Landscape Mode: - Containing View Pager with 3 Tabs (which contains 3 Fragments all having different views and inflating 3 different layouts.

How can I achieve this ?

Thanks,

Upvotes: 0

Views: 169

Answers (1)

Waza_Be
Waza_Be

Reputation: 39558

Create a boolean in values-land that is set to true and false in values.

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

Depending on the value of this boolean, you can set different Fragments in your adapter.

Upvotes: 1

Related Questions