【发布时间】:2017-08-14 09:38:27
【问题描述】:
我正在做的是我试图改变Toolbar,StatusBar和Tablayout颜色而不是默认的theme颜色,我能够成功地改变所有widgets的颜色但是得到Tablayout 中应用主题的原色某种边界不知道为什么?谁能告诉我如何删除它?是否有任何默认样式被定义为Tablayout 的边缘也不是矩形。
屏幕:
xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/app_bar_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".mainFlow.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
android:background="@color/colorPrimaryDark"
app:tabIndicatorHeight="2dp"
app:tabMode="fixed"
app:tabIndicatorColor="@color/white"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
【问题讨论】:
-
使用
app:tabBackground="@drawable/colorPrimaryDark" -
@Wizard 我想以编程方式更改背景颜色
标签: android android-tablayout android-coordinatorlayout android-appbarlayout