一、一般我们都是使用布局文件直接加载到Activity,从而覆盖了Activity的颜色。这里没有加载布局文件(没有用R.layout.main)
Resources res = getResources();
Drawable drawable = res.getDrawable(R.drawable.bkcolor);
this.getWindow().setBackgroundDrawable(drawable);
这样做需要在value目录下的string.xml文件中加入一段代码,如下
<drawable name="bkcolor">#ff00ff</drawable>
二、设置控件背景及文字颜色
private test_editText=null;
test_editText= (EditText) findViewById(R.id.EditTextInput);
test_editText.setBackgroundColor(R.drawable.Black); //设置为黑色背景
test_editText.setBackgroundColor(Color.BLACK); //设置为黑色背景
test_editText.setBackgroundColor(Color.TRANSPARENT);//设为透明的
test_editText.setTextColor(Color.WHITH);//设置为黑色背景android.graphics.Color