Cha*_*dru 15 android android-2.3-gingerbread material-design floating-action-button androiddesignsupport
我在改变FAB的xml中的backgroundTint颜色时面临一个问题,即没有为具有Gingerbread版本的设备分配颜色.我真的很困惑,不知道为什么它表现得很奇怪.我完全坚持这个问题几个小时触发解决方案,但我不能.请帮助我提出解决问题的建议和建议.我发布了我的代码和问题的屏幕截图供您参考.提前致谢.
include_fab.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="20dp"
android:layout_marginRight="20dp"
app:backgroundTint="#FF0000"
app:borderWidth="0dp"
app:elevation="5dp"
app:fabSize="normal"/>
Run Code Online (Sandbox Code Playgroud)
我的gradle中的设计支持库
compile 'com.android.support:design:23.0.0'
Run Code Online (Sandbox Code Playgroud)
GingerBread和KitKat 版本的屏幕截图
注意:我在GingerBread设备上方获得了我的要求的准确输出.单独使用GingerBread会出现问题.
它可能会起作用
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FloatingActionButton v = (FloatingActionButton) findViewById(R.id.fab);
ColorStateList csl = new ColorStateList(new int[][]{new int[0]}, new int[]{0xffff0000});
v.setSupportBackgroundTintList(csl);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1224 次 |
| 最近记录: |