我最近决定在我的应用程序中开始使用"材料设计".编译期间出现此错误:
Error:(12, 22) No resource found that matches the given name: attr 'windowNoTitle'.
Run Code Online (Sandbox Code Playgroud)
下面是指向这个styles.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">
</style>
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我试图用来ColorStateList改变a的颜色RadioGroup,但遇到一些基本的错误.我可以在RadioGroup不使用的情况下更改按钮的颜色ColorStateList吗?有没有更简单的方法?
我已导入以下内容并仍然"无法解析符号".
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ColorDrawable;
Run Code Online (Sandbox Code Playgroud)
我正在尝试ColorStateList在下面实现,不确定我是否正确执行,但首先我需要修复'无法解决符号错误':
if (Item.getCar()=='Audi'){
ColorStateList csl = new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_enabled}, //disabled
new int[]{android.R.attr.state_enabled} //enabled
},
new int[] {
Color.BLACK //disabled
,Color.BLUE //enabled
}
);
int textColor = Color.parseColor("#000000");
x.radioGroup.set(ColorStateList.valueOf(textColor));
Run Code Online (Sandbox Code Playgroud)
任何帮助尝试ColorStateList上班的人都表示赞赏.