【问题标题】:Set PagerTabstrip to bottom of screen将 PagerTabstrip 设置为屏幕底部
【发布时间】:2015-09-10 15:17:43
【问题描述】:

通常 PagerTabStrip 出现在屏幕顶部,就在 appbar 下方,现在我希望 PagerStrip 位于底部,如何将其设置为屏幕底部? 帮帮我.. 代码:

<LinearLayout
android:id="@+id/main_container"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AppHomeScreen"
xmlns:app="http://schemas.android.com/apk/res-auto">
<include
    android:id="@+id/appbar"
    layout="@layout/app_bar_layout"
    />
<android.support.v4.widget.DrawerLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drawer">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/content_container">
        <android.support.v4.view.ViewPager
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <android.support.v4.view.PagerTabStrip
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:background="#0ff"
                android:id="@+id/pager_tabs"
                android:layout_alignParentBottom="true"
                >

            </android.support.v4.view.PagerTabStrip>
        </android.support.v4.view.ViewPager>
    </RelativeLayout>

    <fragment
        android:layout_width="200dp"
        android:layout_height="match_parent"
        app:layout="@layout/fragment_navigation_drawer"
        android:layout_gravity="right"
        android:name="neppro.com.busapp.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer"/>
</android.support.v4.widget.DrawerLayout>

现在,这是我最新更新的代码,我在 viewPager 中使用了相对布局,但我也已经尝试过使用 LinearLayout。

【问题讨论】:

    标签: android pagertabstrip


    【解决方案1】:

    将 PagerTabStrip 上的 layout_gravity 属性设置为“底部”

    android:layout_gravity="bottom"
    

    【讨论】:

    • 能否将您的布局文件粘贴到您的问题中
    猜你喜欢
    • 2015-03-17
    • 1970-01-01
    • 2015-06-28
    • 2016-01-27
    • 2017-12-28
    • 1970-01-01
    • 2017-05-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多