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 #889 from huanxuaner/master
Browse files Browse the repository at this point in the history
#25 实验报告1、2、3、4
  • Loading branch information
zengsn authored Nov 5, 2020
2 parents b2c7c34 + a8d9662 commit f364a30
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 0 deletions.
Binary file added students/net1814080903109/lab1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions students/net1814080903109/lab1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# 一、实验目标
1. 搭建 Android(Android Studio)开发环境;
2. 熟悉并掌握Git与GitHub.com提交实验代码的方法

# 二、实验内容
1. 搭建Android Studio环境,配置SDK;
2. 创建一个名为Net学号Activity的java类;
3. 安装git,熟悉git bash的命令;
4. 上交实验相关文件

# 三、实验步骤
1. 搭建Android Studio环境,配置相应的相应SDK之后;
2. 创建一个名为Net1814080903109Activity的java类;
3. 将hzuapps/android-labs-2020的项目Fork到自己的github账号下;
4. 将android-labs-2020项目克隆到本地;
5. 用git bash提交Net1814080903109Activity.java

# 四、实验结果
![lab1](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab1.PNG)

# 五、实验心得
一开始搭建Android studio环境时出了很多问题,如无法连接阿里云镜像和无法打开守护者进程等,由于安装的是新版的Android studio,所以网上针对旧版的解决方案大多已经失效,只能不断尝试各种解决方案。
创建项目这一过程问题不大。
用git bash提交代码这一环节由于不熟练所以也出了很多意外,但多尝试几次就能熟练运用。
Binary file added students/net1814080903109/lab2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions students/net1814080903109/lab2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# 一、实验目标
1. 创建2-3个与自己选题有关的Activity
2. 利用Intent实现Activity间的跳转

# 二、实验内容
1. 根据功能创建相应的Activity;
2. 编写Activity对应的布局文件;
3. 实现各个Activity之间的跳转;

# 三、实验步骤
1. 将创建的Activity注册到AndroidManifest.xml;
2. 在Net1814080903220MainActivity的layout文件视图中添加Button按钮用于跳转页面;
3. 为按键添加事件处理:
```
Button button1 = (Button)findViewById(R.id.btn1);
button1.setOnClickListener(new View.OnClickListener() { //匿名类
@Override
public void onClick(View v) { //功能
Intent intent = new Intent(Net1814080903109Activity.this, XXX.class);
startActivity(intent);
}
```
4. 创建相应功能的Activity名为'XXX';
5. 利用startActivity(intent)实现跳转;

# 四、实验结果
![lab2](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab2.PNG)
![lab2_Lighten](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab2_Lighten.PNG)
![lab2_TurnoffScreen](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab2_TurnoffScreen.PNG)

# 五、实验心得
本次实验主要是为了实现不同功能之间的页面跳转,要预先准备好用到的需要的Activity对应的Layout文件,进一步确定自己制作的app需要的功能。
Binary file added students/net1814080903109/lab2_Lighten.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/net1814080903109/lab2_TurnoffScreen.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions students/net1814080903109/lab3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

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

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

# 三、实验步骤
1. 将需要导入的图片保存到res/drawable路径中;
2. 在layout的xml文件中用ImagView导入图片作为背景:
```
<ImageView
android:src="@drawable/图片名"/>
```

# 四、实验结果
![lab3_main](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab3_main.PNG)
![lab3_Lighten](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab3_Lighten.PNG)
![lab3_TurnoffScreen](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab3_TurnoffScreen.PNG)

# 五、实验心得
这次实验难度较浅,在界面视图中插入图片的操作简单易懂,主要是将图片设置为最底层不会覆盖其他控件较麻烦。
Binary file added students/net1814080903109/lab3_Lighten.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/net1814080903109/lab3_TurnoffScreen.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/net1814080903109/lab3_main.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions students/net1814080903109/lab4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# 一、实验目标
1. 根据选题要求设计界面布局及控件使用;
2. 布局xml及界面控制操作代码提交并截图;
3. 将应用运行结果截图。

# 二、实验内容
1. 使用一种布局方式设计界面;
2. 通过控件ID获取界面对象,执行相关操作:
```
// XML
android:id="@+id/my_button"
// Java
findViewById(R.id.my_button);
```
3. 实现界面控件的事件处理;
4. 操作之后,切换到第二个界面。

# 三、实验步骤
1. 三个页面均采用自适应布局(默认布局),插入自己要用的控件;
2. 根据需要在界面对应的java类中通过控件ID添加事件处理:
```
xml:
<Button
...
android:id="@+id/XXX"
...
/>
java:
Button button1 = (Button)findViewById(R.id.XXX);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
...(要实现的功能)
startActivity(intent);
}
```

# 四、实验结果
![lab4_Lighten](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab4_Lighten.PNG)
![lab4_TurnoffScreen](https://raw.githubusercontent.com/huanxuaner/android-labs-2020/master/students/net1814080903109/lab4_TurnoffScreen.PNG)

# 五、实验心得
这次实验已经实现了其中一个功能,但在虚拟机上无法体现,安装到手机上实操后才能实现调节亮度的功能。
而界面的布局根据自己的使用喜好和是否顺手来选择即可,本次实验使用自适应布局是因为便于调整控件的位置。
Binary file added students/net1814080903109/lab4_Lighten.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/net1814080903109/lab4_TurnoffScreen.PNG
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 f364a30

Please sign in to comment.