简体   繁体   English

viewpager中的垂直pagerTabStrip方向

[英]Vertical pagerTabStrip orientation in viewpager

This is possible duplicate of How to make vertical PagerTabStrip for VerticalViewPager android 这可能与如何为VerticalViewPager android制作垂直PagerTabStrip重复

but I'm still curious how to achieve the same effect, only in horizontal way? 但我仍然好奇如何才能达到同样的效果,只能横向进行? Maybe there are any libraries for that or somebody know how to customize PagerTabStrip? 也许有任何库或有人知道如何自定义PagerTabStrip?

It has no orientation attribute, so I can't make it work at first glance. 它没有方向属性,所以我乍看之下无法使它工作。

<android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.v4.view.PagerTabStrip
            android:id="@+id/pagerTabStrip"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top">
        </android.support.v4.view.PagerTabStrip>
    </android.support.v4.view.ViewPager>

You can achieve the same effect and architecture, using Master/Detail Fragments , like the layout of Email apps that show the inbox on one list fragment on the left vertically, and show the details of that message on the right in another fragment. 您可以使用Master/Detail Fragments实现相同的效果和体系结构,例如在左侧垂直显示一个列表片段的收件箱的电子邮件应用程序布局,并在另一个片段的右侧显示该消息的详细信息。

You can follow this tutorial to implement Master/Detail in Android using Fragments. 您可以按照本教程使用片段在Android中实现Master / Detail。

Since the Master is a fragment which hosts a listview or recyclerview, you have great control and customization on the layouts. 由于Master是一个托管listview或recyclerview的片段,因此您可以对布局进行很好的控制和自定义。

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

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