これが私のアプリケーションの短いスケッチです
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start);
... //at this place, getWindow().setBackgroundDrawableResource(int resid)
//would work perfectly
mainView();
}
void mainView() {
setContentView(R.layout.main);
...
if (...) {
getWindow().setBackgroundDrawableResource(R.drawable.anyDrawable);
}
...
}
しかし、mainView()では、そのメソッドは何も影響しません。そして、例外はスローされません。
main.xmlはすでに背景画像を定義していますが、start.xmlはそれを行いません。これは私の問題を引き起こす可能性がありますか?
または、別の方法で背景画像を変更できますか?