您的位置:首页 > 移动开发 > Android开发

更换安卓应用的背景 java android

2013-06-26 15:13 435 查看
想要更新应用的背景:

具体步骤:

1.在xml布局文件中,对最外层的LinearLayout设置id:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/background"
android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background1"
    android:orientation="vertical" >


2.在activity中添加:

LinearLayout background;
background = (LinearLayout) findViewById(R.id.background);


3.在相应位置(你想更换背景的时候),写上代码:

background.setBackgroundResource(R.drawable.your_pic);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: