如何添加背景图片的活动? [英] how to add background image to activity?

查看:109
本文介绍了如何添加背景图片的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用的主题或ImageView的?

using theme or ImageView ?

推荐答案

使用安卓背景属性在你的XML。如果你想将它应用到整个活动最简单的方法就是把它放在你的布局的根。所以,如果你有一个RelativeLayout的作为XML的开始,把它放在这里:

use the android:background attribute in your xml. Easiest way if you want to apply it to a whole activity is to put it in the root of your layout. So if you have a RelativeLayout as the start of your xml, put it in here:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rootRL"
    android:orientation="vertical" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:background="@drawable/background">
</RelativeLayout>

这篇关于如何添加背景图片的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆