如何将背景图像添加到活动? [英] how to add background image to activity?
本文介绍了如何将背景图像添加到活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用主题或 ImageView ?
using theme or ImageView ?
推荐答案
在你的 xml 中使用 android:background
属性.如果要将其应用于整个活动,最简单的方法是将其放在布局的根目录中.因此,如果您有一个 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屋!
查看全文