u2g*_*les 4 android ripple android-design-library
当我设置"22.2.0 Android设计库"TabLayout(android.support.design.widget.TabLayout)的tabBackground属性时,会出现两个问题:
这在Lollipop和Kitkat设备上都会发生.
如果没有tabBackground设置,涟漪效果和制表符指示都会起作用,但背景的默认颜色与工具栏不同,这与材料设计指南不完全一致.
请在下面找到XML:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
app:tabBackground = "?attr/colorPrimary" />
Run Code Online (Sandbox Code Playgroud)
Hub*_*uby 15
用android:background="?attr/colorPrimary"而不是app:tabBackground = "?attr/colorPrimary".
如果您有深色原色,您可能还想将主题更改为ThemeOverlay.AppCompat.Dark.这使文本和波纹颜色变白.
完整示例:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2846 次 |
| 最近记录: |