我想要使用html顏色參考更改佈局的背景顏色。但我似乎無法使它工作。 這裏是我如何試圖做到這一點使用html顏色參考更改背景android的顏色
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中工作。 – 2013-02-18 11:57:30