forked from hzuapps/android-labs-2020
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 一、实验报告 | ||
|
||
1. 了解Android应用中各种资源的概念与使用方法; | ||
2. 掌握在Android应用中使用图片等资源的方法。 | ||
|
||
# 二、实验内容 | ||
|
||
1. 在界面上显示至少一张图片(按照自己的题目添加); | ||
2. 提交res/drawable及图片使用的代码; | ||
3. 提交res/values, res/layout等其他代码; | ||
4. 将应用运行结果截图,放到实验报告中; | ||
5. 点击图片(或按钮)时,打开另一个Activity。 | ||
|
||
# 三、实验步骤 | ||
|
||
1. 将需要导入的图片保存到res/drawable路径中; | ||
|
||
2. 在layout的main.xml文件中设置`android:background`属性来导入图片作为背景: | ||
|
||
```xml | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".Net1814080903131Activity" | ||
android:background="@drawable/youdao"> | ||
``` | ||
|
||
|
||
|
||
# 四、实验结果 | ||
|
||
![实验效果图] | ||
|
||
# 五、实验心得 | ||
|
||
本次实验主要学会添加一个背景图,要先把背景图导入drawable文件夹中,利用background添加背景避免了重叠问题。 |