【发布时间】:2013-02-02 19:59:27
【问题描述】:
我正在尝试使用 html 颜色参考来更改布局的背景颜色。但我似乎无法让它工作。 这就是我正在尝试的方法
public class FormEngine {
Context context;
RelativeLayout relLayout;
FormEngine(Context ctx) {
context = ctx;
relLayout = new RelativeLayout(context);
}
public void clearScreen(int color) {
relLayout.setBackgroundColor(color);
}
} 这就是我调用这个类的方式
FormEngine fEngine = new FormEngine(MainActivity.this);
setContentView(fEngine.relLayout);
fEngine.clearScreen(0x708090);
现在,如果我只是尝试在 setBackground 颜色中使用 Color.Yellow 它按预期工作,但是当我传递这样的颜色值时,它只显示白色背景。 任何帮助将不胜感激。
【问题讨论】:
标签: android html layout colors