forked from hzuapps/android-labs-2018
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="soft1614080902434.androidlabs.hzuapps.edu.soft1614080902434"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".Wechat"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".Second_Activity"></activity> | ||
</application> | ||
|
||
</manifest> |
13 changes: 13 additions & 0 deletions
13
...80902434/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902434/Second_Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package soft1614080902434.androidlabs.hzuapps.edu.soft1614080902434; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
|
||
public class Second_Activity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_second_); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
soft1614080902434/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902434/Wechat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package soft1614080902434.androidlabs.hzuapps.edu.soft1614080902434; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
public class Wechat extends AppCompatActivity implements View.OnClickListener { | ||
Button b; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_wechat); | ||
b = (Button)findViewById(R.id.but); | ||
b.setOnClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View view) { | ||
if(view==b){ | ||
Intent intent = new Intent(); | ||
intent.setClass(Wechat.this,Second_Activity.class); | ||
startActivity(intent); | ||
} | ||
} | ||
|
||
@Override | ||
public void onPointerCaptureChanged(boolean hasCapture) { | ||
|
||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
soft1614080902434/app/src/main/res/layout/activity_second_.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?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=".Second_Activity"> | ||
<ImageView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:src="@drawable/wc"/> | ||
|
||
|
||
</android.support.constraint.ConstraintLayout> |
39 changes: 39 additions & 0 deletions
39
soft1614080902434/app/src/main/res/layout/activity_wechat.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AbsoluteLayout 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=".Wechat"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="80dp" | ||
android:layout_x="158dp" | ||
android:layout_y="122dp" | ||
android:text=" Wechat " | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/but" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_x="23dp" | ||
android:layout_y="408dp" | ||
android:text="聊天" | ||
tools:layout_editor_absoluteX="28dp" | ||
tools:layout_editor_absoluteY="447dp" /> | ||
|
||
<Button | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_x="254dp" | ||
android:layout_y="414dp" | ||
android:text="表情包" | ||
tools:layout_editor_absoluteX="262dp" | ||
tools:layout_editor_absoluteY="447dp" /> | ||
|
||
</AbsoluteLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="app_name">soft1614080902434</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# 第三次实验 | ||
## 1.实验目的 | ||
掌握在Android应用中使用图片等资源的方法 | ||
## 2.实验步骤 | ||
|
||
1、打开实验2时的工程项目 | ||
|
||
2、在edu\hzuapps\androidlabs\soft1614080902434下新建Activity,命名为Second_Activity | ||
|
||
3、将图片wc.png粘贴至res/drawable目录下 | ||
|
||
4、在second_activity.xml中添加控件ImageView,其代码为 | ||
|
||
<ImageView | ||
|
||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:src="@drawable/wc"/> | ||
|
||
5、在soft_1614080902434_activity.xml中添加Button控件 | ||
6、在soft1614080902419Activity类中添加Button | ||
|
||
|
||
b,并监听,其代码如下: | ||
|
||
@Override | ||
|
||
public void onClick(View view) { | ||
|
||
if(view==b){ | ||
Intent intent = new Intent(); | ||
intent.setClass(Wechat.this,Second_Activity.class); | ||
startActivity(intent); | ||
} | ||
}: | ||
|
||
8、编译运行 | ||
|
||
9、打开git bash,将文件夹push上github,向老师提交pull request. | ||
|
||
## 3.实验结果: | ||
|
||
|
||
## 4.实验体会: | ||
学会了怎么新建Activity、如何添加图片、怎么切换Activity。,刚开始做的时候,因为我的电脑运行不了虚拟机,因为BIOS设置不了,所以我只能用实体机运行,而我的实体机型号是范围是1980*1080,而Android studio没有这个范围,所以就选了另一个范围,这就导致了布局有点尴尬。这次实验,算是初步了解怎么安装按钮和监听了。 |