首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何将页面标题条放在中间顶部

如何将页面标题条放在中间顶部
EN

Stack Overflow用户
提问于 2018-05-30 05:01:21
回答 1查看 89关注 0票数 -1

我正在尝试更新我的应用程序,想让工具栏看起来像黑色播放器

。到目前为止,我可以设置搜索和导航,但是如何将页面标题条放在中间作为内部视图页面,我不能使用重力,我尝试了页边距和填充根本不起作用。这是我的xml

代码语言:javascript
复制
   <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" />

如何将页面标题条放在中间?

所以我想把填充物放进去,但根本做不到。

EN

回答 1

Stack Overflow用户

发布于 2018-05-30 07:02:01

看起来你想改变StatusBarColor。

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

代码语言:javascript
复制
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

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

代码语言:javascript
复制
android:fitsSystemWindows="true"

但是由于您没有指定您正在使用的API,我建议您参考不同的问题,您应该会找到答案。

How to change the status bar color in android

Android Completely transparent Status Bar?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50592876

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档