简体   繁体   English

Android选项卡页面指示器将viewpager的底部置于行lindicator的顶部

[英]Android tab page indicator place bottom of viewpager with line lindicator on top

I am using TabePageIndicator and by default the tabs are top aligned. 我正在使用TabePageIndicator,并且默认情况下,选项卡的顶部对齐。 But in my App I need to place them at the bottom of the view pager. 但是在我的应用程序中,我需要将它们放置在视图寻呼机的底部。 I tried with the following code, tabs are bottom aligned but the line still shows at the bottom. 我尝试使用以下代码,选项卡底部对齐,但该行仍显示在底部。 Please provide me with any possible solutions. 请为我提供任何可能的解决方案。 Thanks! 谢谢!

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
    android:orientation="vertical" >

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:padding="14dp" />

    <com.viewpagerindicator.TabPageIndicator
        android:id="@+id/indicator"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        app:linePosition="top" />

</LinearLayout>

Expected result: 预期结果:

在此处输入图片说明

您可以使用负边距实现效果,但是请注意,对于LinearLayout,以下元素将在上一个元素的顶部分层。

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

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