我想设置一个相对布局与背景的backgroundColor,设置相对布局
relativeLayout1.setBackgroundColor(0x00000000);
我的程序不断虽然崩溃。这是logcat。
代码:
RelativeLayout window=(RelativeLayout) findViewById(R.id.window);
window.setBackgroundColor(0x00000000);
这是分开的唯一东西从常规代码setContentView(R.layout.something);
和super.onCreate(savedInstanceState);
整个代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_invisible);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
window=(RelativeLayout) findViewById(R.id.window);
window.setBackgroundColor(0x00000000);
}
将您的代码从'onStart'发布到您的brightnessService中。 – Ralgha
@Ralgha - 我改变了pastebin链接。那是错误的logcat。 –
如果你让我们知道第45行(指向你的logcat)是什么,那肯定会有帮助。也只是一个提示,你可能想从[Android开发网站](http://developer.android.com/reference/android/graphics/Color.html#TRANSPARENT)使用Color.TRANSPARENT而不是0x00000000(http://developer.android.com/reference/android/graphics/Color.html#TRANSPARENT) – syklon