【转】Android设置背景图片【原创】 Android开发,设置背景图片
Android1.6运行通过
开发环境:NentBeans6.9.1 + nbandroid

1.先在建好的工程目录(我的是:D:\我的文档\NetBeansProjects\Android1.6工程\背景图片\AndroidBgImg\res\)下
新建一个drawable文件夹,把背景图片放进去,我用的是bg1.png,如下:




2.修改main.xml,在LinearLayout 里添加android:background="@drawable/bg1"这个属性即可:


<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg1">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello Android from NetBeans"/>
</LinearLayout>


3.java代码

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.me.androidbgimg;

import android.app.Activity;
import android.os.Bundle;

/**
*
* @author Administrator
*/
public class AndroidBgImg extends Activity
{

/** Called when the activity is first created. */
@Override
public void onCreate( Bundle icicle )
{
super.onCreate( icicle );
// ToDo add your GUI initialization code here
this.setContentView( R.layout.main );
}
}

运行效果:



推荐下开的淘宝小店筱夜宫主(http://xiaoyegongzhu.taobao.com/)DR.HU 胡博士美妆~坐在电脑旁的汉子姑娘注意脸部护理呀,做了程序媛,也要美丽啊。。。小店有优惠码:YE4450,报优惠码,抵两元券,(⊙o⊙)…

更多相关文章

  1. Android中欢迎界面背景图片放大效果
  2. Ue4.20 安卓开发配置及Android Studio 调试ue安卓工程
  3. 背景图片颜色渐变
  4. 更换工程的sdk或者google apis
  5. Android中View(视图)绘制不同状态背景图片原理深入分析以及State
  6. Unity导出Android工程生成apk安装包流程
  7. Google工程师解析Android系统架构
  8. 新建Android工程遇到几个问题
  9. Android根据Button状态(normal,focused,pressed)显示不同背景图

随机推荐

  1. Mysql5.7服务无法启动的图文解决教程
  2. mysql 5.7以上版本下载及安装图文教程
  3. MySQL嵌套事务所遇到的问题
  4. 记一次因线上mysql优化器误判引起慢查询
  5. MySql Sql 优化技巧分享
  6. 利用ssh tunnel链接mysql服务器的方法
  7. mysql 全文检索中文解决方法及实例代码
  8. 浅谈mysql可有类似oracle的nvl的函数
  9. 浅谈Mysql中类似于nvl()函数的ifnull()函
  10. Window下Mysql忘记root密码怎么重置