gpt4 book ai didi

android - FAB Color for backgroundTint 在 Gingerbread 版设备中没有改变

转载 作者:可可西里 更新时间:2023-11-01 18:48:05 26 4
gpt4 key购买 nike

我在为 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"/>

在我的 gradle 中设计支持库

compile 'com.android.support:design:23.0.0'

版本截图 GingerBreadKitKat

注意:我在 GingerBread 设备上得到了我的要求的准确输出。单独使用 GingerBread 会出现问题。

enter image description here

最佳答案

可能有用

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);
}

关于android - FAB Color for backgroundTint 在 Gingerbread 版设备中没有改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32537586/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com