Skip to content

Commit

Permalink
Merge pull request #2412 from Susie-Lau/master
Browse files Browse the repository at this point in the history
#3 2201
  • Loading branch information
zengsn authored May 29, 2018
2 parents e16e368 + 820299a commit 6e0c562
Show file tree
Hide file tree
Showing 29 changed files with 615 additions and 0 deletions.
Binary file added Com1614080901125/#2/#2(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions com1614080901125/#3/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com1614080901125.androidlabs.hzuapps.edu.hkmacgo"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion="27" />

<application
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="@style/AppTheme" >
<activity android:name="package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;.Com1614080901125Activity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;.SecordActivity"
android:label="@string/title_activity_secord"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name="com1614080901125.androidlabs.hzuapps.edu.hkmacgo.SecordActivity" />

<provider
android:name="com.android.tools.ir.server.InstantRunContentProvider"
android:authorities="com1614080901125.androidlabs.hzuapps.edu.hkmacgo.com.android.tools.ir.server.InstantRunContentProvider"
android:multiprocess="true" />
</application>

</manifest>
22 changes: 22 additions & 0 deletions com1614080901125/#3/java/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.view.View;

import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import org.w3c.dom.Text;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

}
}
11 changes: 11 additions & 0 deletions com1614080901125/#3/java/SecondActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class SecondActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
24 changes: 24 additions & 0 deletions com1614080901125/#3/report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 第三次实验

## 1.实验目标

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

## 2.实验步骤

统一步骤:
https://github.com/hzuapps/android-labs-2018/blob/master/labs-steps.md
Android 在TextView 中显示图片的4种方式:
https://blog.csdn.net/u012724237/article/details/79010741

## 3.实验结果

![image](https://github.com/Susie-Lau/android-labs-2018/blob/master/com1614080901125/%233/res/drawable/cower.png?raw=true)
![image](https://github.com/Susie-Lau/android-labs-2018/blob/master/com1614080901125/%233/res/drawable/cower2.png)

## 4.实验心得
此次实验虽然只是考验插入图片,但实际上在进行代码操作的时候,由于对java语言的不熟练,导致花费了很多时间去寻找和修改错误,因此,还是需要好好巩固知识。
Binary file added com1614080901125/#3/res/drawable/cower.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 com1614080901125/#3/res/drawable/cower2.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 com1614080901125/#3/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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=".Com1614080901125Activity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="欢迎进入港澳GO!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/maomao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/3-1"
android:text="hello_world" />

</android.support.constraint.ConstraintLayout>
33 changes: 33 additions & 0 deletions com1614080901125/#3/res/layout/activity_second.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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=".SecordActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_second" />

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>
4 changes: 4 additions & 0 deletions com1614080901125/#3/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<string name="¸Û°ÄGO">com1614080901125</string>
<string name="title_activity_secord">SecordActivity</string>
</resources>
64 changes: 64 additions & 0 deletions com1614080901125/#4/java/MainActivity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
protected TextView textView;
protected Button button ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar;
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
textView = findViewById(R.id.textview_01);
button = findViewById(R.id.my_button);

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);
}
});
FloatingActionButton fab;
fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_com1614080901116, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}}
30 changes: 30 additions & 0 deletions com1614080901125/#4/java/SecondActivity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class secondActivity extends AppCompatActivity {
protected Button button ;
protected TextView tes;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab;
fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}

}
20 changes: 20 additions & 0 deletions com1614080901125/#4/report4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 第四次实验

## 实验目的
1.根据选题要求设计界面布局及控件使用;
2.布局xml及界面控制操作代码提交并截图;
3.将应用运行结果截图。(不要做登录注册!)

## 实验内容

1.使用其中一种布局方式,设计所选题目的界面;
2.通过控件ID获取界面对象,执行相关操作;
3.实现界面控件的事件处理;

## 实验结果

![](https://github.com/Susie-Lau/android-labs-2018/blob/master/com1614080901125/%234/res/drawable/text4.png)

## 实验体会

这次实验主要是考验我们对于界面布局的设计,由于电脑无法运行虚拟机,所以只能截图,在这次实验中,接触到的知识点比较多,比如如何去设置按钮的大小,类型,排列等等,步骤虽然比较冗杂,但是效果可以很快看见,也可以随时修改。
Binary file added com1614080901125/#4/res/drawable/text4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions com1614080901125/#4/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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=".activity_main"
tools:layout_editor_absoluteY="100dp">

<Button
android:id="@+id/button1"
android:layout_width="200dp"
android:layout_height="60dp"
android:text="½øÈ붩µ¥"
android:textSize="20sp"
tools:layout_editor_absoluteX="100dp"
tools:layout_editor_absoluteY="120dp" />

<Button
android:id="@+id/button2"
android:layout_width="200dp"
android:layout_height="60dp"
android:text="È¡Ïû¶©µ¥"
android:textSize="20sp"
tools:layout_editor_absoluteX="100dp"
app:layout_constraintTop_toBottomOf="@+id/button1"
tools:layout_editor_absoluteY="0dp"/>

<Button
android:id="@+id/button3"
android:layout_width="200dp"
android:layout_height="60dp"
android:text="Í˳ö"
android:textSize="20sp"
tools:layout_editor_absoluteX="100dp"
app:layout_constraintTop_toBottomOf="@+id/button2"
tools:layout_editor_absoluteY="0dp"/>


<TextView
android:id="@+id/textView"
android:layout_width="364dp"
android:layout_height="171dp"
android:layout_marginTop="84dp"

android:textSize="24dp"
app:layout_constraintTop_toBottomOf="@+id/button3"
tools:layout_editor_absoluteX="18dp" />


</android.support.constraint.ConstraintLayout>
30 changes: 30 additions & 0 deletions com1614080901125/#4/res/layout/second_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com1614080901125.androidlabs.hzuapps.edu.hkmacgo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class secondActivity extends AppCompatActivity {
protected Button button ;
protected TextView tes;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab;
fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}

}
7 changes: 7 additions & 0 deletions com1614080901125/#4/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>
<string name="app_name">My Application</string>
<string name="title_activity_main">MainActivity</string>
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_notifications">Notifications</string>
</resources>
Loading

0 comments on commit 6e0c562

Please sign in to comment.