嵌入式爱好者

Android APP如何添加背景图片

2017-3-25 15:41| 发布者: impscott| 查看: 1269| 评论: 0

类目: I.MX6系列产品  >  Android     文档编号: 106

找到一张合适的图片,将其设置为png格式,添加到drawable-hdpi目录下

设置layout的属性,假设工程为Mytest,修改文件为Mytest/res/layout/activity_main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:layout_gravity="center"

    android:background="@drawable/bg"    //将背景图片添加进去

    android:paddingBottom="@dimen/activity_vertical_margin"

    android:paddingLeft="@dimen/activity_horizontal_margin"

    android:paddingRight="@dimen/activity_horizontal_margin"

    android:paddingTop="@dimen/activity_vertical_margin"

    tools:context=".MainActivity" >


已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-4-27 12:09

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部