Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1455 from SaTarU1IX/master
Browse files Browse the repository at this point in the history
#3 #496 第3次实验
  • Loading branch information
zengsn authored Dec 25, 2020
2 parents f13403d + 47bd416 commit 8d0104c
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 0 deletions.
41 changes: 41 additions & 0 deletions students/net1808081001120/activity_net1808081001120.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Net1808081001120Activity">

<TextView
android:id="@+id/textView"
android:layout_width="77dp"
android:layout_height="46dp"
android:layout_marginEnd="324dp"
android:layout_marginBottom="540dp"
android:text="首页"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<Button
android:id="@+id/button1"
android:layout_width="126dp"
android:layout_height="68dp"
android:layout_marginStart="140dp"
android:layout_marginTop="328dp"
android:text="签到"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/imageView"
android:layout_width="181dp"
android:layout_height="350dp"
android:layout_marginTop="352dp"
android:src="@drawable/picture1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></ImageView>

</androidx.constraintlayout.widget.ConstraintLayout>
21 changes: 21 additions & 0 deletions students/net1808081001120/activity_personview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Net1808081001120Activity">

<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="88dp"
android:layout_marginBottom="44dp"
android:src="@drawable/picture2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button"></ImageView>

</androidx.constraintlayout.widget.ConstraintLayout>
Binary file added students/net1808081001120/lab-3(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added students/net1808081001120/lab-3(2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions students/net1808081001120/lab3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 实验三:Android资源使用编程

## 一、实验目标

1. 了解Android应用中各种资源的概念与使用方法;
2. 掌握在Android应用中使用图片等资源的方法。

## 二、实验要求

1. 在界面上显示至少一张图片(按照自己的题目添加);
2. 提交res/drawable及图片使用的代码;
3. 提交res/values, res/layout等其他代码;
4. 将应用运行结果截图,放到实验报告中;
5. 点击图片(或按钮)时,打开另一个Activity。

## 三、实验步骤

1. 将图片保存到res/drawable,并用小写英文命名

![实验三图片](https://github.com/SaTarU1IX/android-labs-2020/blob/master/students/net1808081001120/picture1.jpg)
![实验三图片](https://github.com/SaTarU1IX/android-labs-2020/blob/master/students/net1808081001120/picture2.jpg)

2. 在 activity_net1808081001120.xml,分别添加 TextView 和 ImagView :

```
android:text="首页"
```

```
android:src="@drawable/picture1"
```


在 activity_personview.xml,添加 ImagView :
```
android:src="@drawable/picture2"
```

## 四、实验结果

![实验三图片](https://github.com/SaTarU1IX/android-labs-2020/blob/master/students/net1808081001120/lab-3(1).png)
![实验三图片](https://github.com/SaTarU1IX/android-labs-2020/blob/master/students/net1808081001120/lab-3(2).png)

## 五、实验心得

通过本次学会了如何在activity中插入图片,并且通过在xml中设置属性来改变图片。
Binary file added students/net1808081001120/picture1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added students/net1808081001120/picture2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8d0104c

Please sign in to comment.