如何将pagertitlestrip放在中心顶部

时间:2018-05-29 21:01:21

标签: android layout android-viewpager android-toolbar

我正在尝试更新我的应用,并希望让工具栏看起来像黑色播放器this type of。截至目前我能够设置搜索和导航,但如何将寻呼机标题条放在中间作为内部viewpager我不能使用重力我尝试边缘和填充根本不工作。 这是我的xml

   <com.antonyt.infiniteviewpager.InfiniteViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <me.alexrs.fontpagertitlestrip.lib.FontPagerTitleStrip
        android:id="@+id/titlestrip"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_marginEnd="50dp"
        android:layout_marginStart="50dp"
        android:background="@color/material_fragment_top"

        app:fontFamily="@font/font"

        app:theme="@style/AppTheme.PopupOverlay" />

</com.antonyt.infiniteviewpager.InfiniteViewPager>

<android.support.v7.widget.Toolbar 
  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="50dp"

    app:theme="@style/CustomActionBar" />

我如何把pagertitlestrip放在中间

It is overlaping所以我想填充填充但是根本不能这样做

1 个答案:

答案 0 :(得分:0)

好像你想改变StatusBarColor。

尝试setStatusBarColor(int)并设置工具栏的颜色,或者可以使其透明 您需要做的就是在主题中设置这些属性:

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

您希望拥有透明状态栏的活动/容器布局需要设置此属性:

android:fitsSystemWindows="true"

但是既然您从未指定过您正在使用的API,我会向您推荐不同的问题,您应该找到答案。

How to change the status bar color in android

Android Completely transparent Status Bar?