diff --git "a/soft1614080902124/QQ\345\233\276\347\211\20720180510091034.jpg" "b/soft1614080902124/QQ\345\233\276\347\211\20720180510091034.jpg" new file mode 100644 index 000000000..37e3c0875 Binary files /dev/null and "b/soft1614080902124/QQ\345\233\276\347\211\20720180510091034.jpg" differ diff --git "a/soft1614080902124/QQ\345\233\276\347\211\20720180510091047.jpg" "b/soft1614080902124/QQ\345\233\276\347\211\20720180510091047.jpg" new file mode 100644 index 000000000..c855026cc Binary files /dev/null and "b/soft1614080902124/QQ\345\233\276\347\211\20720180510091047.jpg" differ diff --git a/soft1614080902124/report3.md b/soft1614080902124/report3.md new file mode 100644 index 000000000..65687eb3f --- /dev/null +++ b/soft1614080902124/report3.md @@ -0,0 +1,30 @@ +# 第三次实验 + +Android资源使用编程 + +## 1.实验目标 + +掌握在Android应用中使用图片等资源的方法。 + +## 2.实验步骤 + +1.在界面上显示至少一张图片(按照自己的题目添加); + +2.提交res/drawable及图片使用的代码; + +3.提交res/values, res/layout等其他代码; + +3.将应用运行结果截图,放到实验报告中; + +4.点击图片(或按钮)时,打开另一个Activity。 + +// 保存在自己的文件夹下 +## 3.实验结果 + +![image](https://github.com/BoyJDG/android-labs-2018/blob/master/soft1614080902124/QQ%E5%9B%BE%E7%89%8720180510091047.jpg) + +![image](https://github.com/BoyJDG/android-labs-2018/blob/master/soft1614080902124/QQ%E5%9B%BE%E7%89%8720180510091034.jpg) + +## 4.实验体会 + 本次实验使用Android Studio编写代码,实现了两个activity,通过此次实验我了解了android一些控件和布局的 + 使用,初步了解了控件点击事件的编写。 diff --git a/soft1614080902124/soft1614080902124/app/src/main/AndroidManifest.xml b/soft1614080902124/soft1614080902124/app/src/main/AndroidManifest.xml index 8559b97cd..e23b04bfa 100644 --- a/soft1614080902124/soft1614080902124/app/src/main/AndroidManifest.xml +++ b/soft1614080902124/soft1614080902124/app/src/main/AndroidManifest.xml @@ -16,6 +16,10 @@ + \ No newline at end of file diff --git a/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity.java b/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity.java index 17f8341b9..57b4c4d63 100644 --- a/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity.java +++ b/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity.java @@ -1,13 +1,31 @@ package edu.hzuapps.androidlabs.soft1614080902124; +import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.view.View; +import android.widget.Button; + public class Soft1614080902124Activity extends AppCompatActivity { + Button button = null; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_soft1614080902124); + + button = (Button)findViewById(R.id.button1); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(); + intent.setClass(Soft1614080902124Activity.this,Soft1614080902124Activity_2.class); + startActivity(intent); + } + }); + + } } diff --git a/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity_2.java b/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity_2.java new file mode 100644 index 000000000..eefff2f73 --- /dev/null +++ b/soft1614080902124/soft1614080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Soft1614080902124Activity_2.java @@ -0,0 +1,13 @@ +package edu.hzuapps.androidlabs.soft1614080902124; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +public class Soft1614080902124Activity_2 extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_soft1614080902124_2); + } +} diff --git a/soft1614080902124/soft1614080902124/app/src/main/res/drawable/tu.jpg b/soft1614080902124/soft1614080902124/app/src/main/res/drawable/tu.jpg new file mode 100644 index 000000000..7e20da9d5 Binary files /dev/null and b/soft1614080902124/soft1614080902124/app/src/main/res/drawable/tu.jpg differ diff --git a/soft1614080902124/soft1614080902124/app/src/main/res/layout/activity_soft1614080902124.xml b/soft1614080902124/soft1614080902124/app/src/main/res/layout/activity_soft1614080902124.xml index ee13f0b3c..5c52b8058 100644 --- a/soft1614080902124/soft1614080902124/app/src/main/res/layout/activity_soft1614080902124.xml +++ b/soft1614080902124/soft1614080902124/app/src/main/res/layout/activity_soft1614080902124.xml @@ -4,15 +4,21 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="edu.hzuapps.androidlabs.soft1614080902124.Soft1614080902124Activity"> + tools:context=".Soft1614080902124Activity"> - +