Skip to content

Commit

Permalink
Merge pull request #1819 from xiaojiahao/master
Browse files Browse the repository at this point in the history
#4 #1161 实验4
  • Loading branch information
zengsn authored May 12, 2018
2 parents 29f8439 + abf9c9f commit c32388a
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 23 deletions.
28 changes: 5 additions & 23 deletions soft1614080902319/report3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,11 @@
掌握在Android应用中使用图片等资源的方法。

## 2.实验步骤
阅读实验要求:https://github.com/hzuapps/android-labs-2018/labels/Lab


在电脑上Android Studio编写代码


// 代码要可以运行!

使用Git将代码提交到自己的库中:https://github.com/YOUR_NAME/android-labs-2018

$ git pull

$ git add 学号目录/* (git rm 学号目录/*)

$ git push
在自己的GitHub库上创建和发送Pull Request(注意查看Changed files)

// 是否只修改了自己的文件?

在GitHub中使用Markdown文件编写实验报告

// 保存在自己的文件夹下

(1)、在res.layout中的主activity中用design拖入一个button,设置好ID(button1);
(2)、在res.drawable中加入一张图;
(3)、继续在步骤1主activity中的android.support.constraint.ConstraintLayout中加入
android:background="@drawable/dark"(其中dark是文件名字),以该图为主activity的背景;
(4)、在java中的MainActivity中加入监听机构的代码,使得能够点击按钮(button1)能跳到activity_2界面去;
## 3.实验结果

![image](https://github.com/xiaojiahao/android-labs-2018/blob/master/soft1614080902319/sy3(1).jpg)
Expand Down
26 changes: 26 additions & 0 deletions soft1614080902319/report4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 第四次实验

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

## 2.实验步骤
(1)、在res.layout中的activity_2中用design拖入Layouts的LinearLayout在界面中间;
(2)、在LinearLayout中添加四个按钮,并将他们的text内容改成词汇测试选项内容,由于text内容中所有字母默认
全显示大写,故在values.styles中加入代码 <item name="android:textAllCaps">false</item>;
(3)、以TextView的形式加入要测试的单词,
android:gravity="center_horizontal" 文字居中显示
android:text="agreement" 设置文本框内容
android:textColor="#ff5e8e" 设置文本颜色,为红色
android:textSize="33dp"; 设置文字大小
(4)、设置一个按钮next放在下面,界面基本形成;
## 3.实验结果

![image](https://github.com/xiaojiahao/android-labs-2018/blob/master/soft1614080902319/sy4.png)

## 4.实验体会

这次实验使我学会了很多新的操作,通过这次实验我对这个app的实现更加有想法了,刚开始只是在design中把按钮拖到想
要的位置,结果在虚拟机app运行后按钮全都跑到左上角了,后来就在按钮上四条线拉到四边才固定住了。

Binary file added soft1614080902319/sy4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions soft1614080902319/实验2/res/layout/activity_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,83 @@
android:layout_height="match_parent"
tools:context=".Activity_2">

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="368dp"
android:layout_height="268dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="66dp"
android:text="A n.协定;协议;契约;达成协议;同意,一致" />

<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="66dp"
android:text="B n.家庭,家族,王室;adj.家庭的,家族的,家属的" />

<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="66dp"
android:text="C vt.幸免于;从…中生还;vi.幸存" />

<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="66dp"
android:text="D adj.紧张的,拉紧的;vt.(使)紧张,(使)拉紧;vi.拉紧,变得紧张;n.[语法]时态" />

</LinearLayout>

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:text="agreement"
android:textColor="#ff5e8e"
android:textSize="33dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.095" />

<Button
android:id="@+id/next1"
android:layout_width="88dp"
android:layout_height="48dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.939" />
</android.support.constraint.ConstraintLayout>
12 changes: 12 additions & 0 deletions soft1614080902319/实验2/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:textAllCaps">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>

0 comments on commit c32388a

Please sign in to comment.