0
有沒有辦法直接在應用程序中更改背景? (!不是主屏幕壁紙)如何更改應用程序的背景?
有沒有辦法直接在應用程序中更改背景? (!不是主屏幕壁紙)如何更改應用程序的背景?
您需要指定其背景將被更改的佈局。我猜你有一個的LinearLayout,所以加一個id佈局(如果不存在的話):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:[email protected]+id/parentLayout>
然後你就可以改變Java中的背景:
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.parentLayout);
linearLayout.setBackgroundResource(R.drawable.new_background);
希望它可以幫助你!
我有一個鏈接爲你很容易改變背景的應用程序。 嘗試類似https://www.youtube.com/watch?v=mDKuWIlSNJE