码迷,mamicode.com
首页 > 移动开发 > 详细

android怎么换背景图片

时间:2015-06-20 16:55:54      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

我不晓得一般是怎么做的,但是至少可以用两种方法,一种是用一个全屏的ImageView来当作背景,通过修改imageview来修改背景图片,一种是将你xml中最外层的那个布局,LinerLayout之类的,添加id属性,在程序中通过这个来setbackgroundResource。

 

 

我添加了没问题啊。<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/bg"
    >
而且,我直接用        HelloWorld.this.getWindow().setBackgroundDrawableResource(R.drawable.icon);getWindow也可以实现,前面的HelloWorld是当前Activity的名称

android怎么换背景图片

标签:

原文地址:http://www.cnblogs.com/bnuvincent/p/4590710.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!