我正在尝试更新我的应用程序,想让工具栏看起来像黑色播放器
。到目前为止,我可以设置搜索和导航,但是如何将页面标题条放在中间作为内部视图页面,我不能使用重力,我尝试了页边距和填充根本不起作用。这是我的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" />
如何将页面标题条放在中间?
所以我想把填充物放进去,但根本做不到。
发布于 2018-05-30 07:02:01
看起来你想改变StatusBarColor。
尝试setStatusBarColor(int)
并设置工具栏的颜色,或者您可以将其设置为透明,所有您需要做的就是在主题中设置这些属性:
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
您希望具有透明状态栏的活动/容器布局需要此属性设置:
android:fitsSystemWindows="true"
但是由于您没有指定您正在使用的API,我建议您参考不同的问题,您应该会找到答案。
https://stackoverflow.com/questions/50592876
复制相似问题