Skip to content

Commit

Permalink
hzuapps#4 hzuapps#882 第四次实验+报告修改
Browse files Browse the repository at this point in the history
  • Loading branch information
545072985 committed May 12, 2018
1 parent 961097a commit 3c20ff2
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 57 deletions.
4 changes: 4 additions & 0 deletions soft1614080902204/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<activity
android:name=".soft1614080902204BActivity"
android:label="@string/title_activity_soft1614080902204_b"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".soft1614080902204CActivity"
android:label="@string/title_activity_soft1614080902204_c"
android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class soft1614080902204Activity extends AppCompatActivity {

private TextView textView;

private Button kaishi;
@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_soft1614080902204);
textView=(TextView)findViewById(R.id.textview_01);

kaishi=(Button)findViewById(R.id.button_01_01);
textView.setOnClickListener(new View.OnClickListener() {

@Override
Expand All @@ -29,7 +30,16 @@ public void onClick(View v) {
}

});
kaishi.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {
Intent intent=new Intent(soft1614080902204Activity.this,soft1614080902204BActivity.class);
startActivity(intent);
}

});
}

}
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
package com.example.gwl20.soft1614080902204;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;

public class soft1614080902204BActivity extends AppCompatActivity {

private Button bu,jiandao,shitou;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_soft1614080902204_b);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
bu=(Button)findViewById(R.id.button_bu);
jiandao=(Button)findViewById(R.id.button_jiandao);
shitou=(Button)findViewById(R.id.button_shitou);
bu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(soft1614080902204BActivity.this,soft1614080902204CActivity.class);
startActivity(intent);
}
});
jiandao.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();
public void onClick(View v) {
Intent intent=new Intent(soft1614080902204BActivity.this,soft1614080902204CActivity.class);
startActivity(intent);
}
});
shitou.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(soft1614080902204BActivity.this,soft1614080902204CActivity.class);
startActivity(intent);
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.gwl20.soft1614080902204;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

public class soft1614080902204CActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_soft1614080902204_c);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,27 @@
android:layout_height="match_parent"
tools:context=".soft1614080902204Activity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">

<TextView
android:id="@+id/textview_01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/timg"
android:text="hello_world" />
<TextView
android:id="@+id/textview_01"
android:layout_width="wrap_content"
android:layout_height="450dp"
android:drawableTop="@drawable/timg" />

<Button
android:id="@+id/button_01_01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="开始游戏"
android:textStyle="bold"
android:textSize="28sp"
android:background="#F5fffa"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,53 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".soft1614080902204BActivity">

<android.support.design.widget.AppBarLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/timg"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="请选择要出的拳"
android:textStyle="bold"
android:textSize="28sp"
android:background="#DB7093"/>

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

<Button
android:id="@+id/button_bu"
android:layout_width="125dp"
android:layout_height="50dp"
android:text=""/>

<Button
android:id="@+id/button_jiandao"
android:layout_width="125dp"
android:layout_height="50dp"
android:text="剪刀"/>

<Button
android:id="@+id/button_shitou"
android:layout_width="125dp"
android:layout_height="50dp"
android:text="石头"/>

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

<include layout="@layout/content_soft1614080902204_b" />
</LinearLayout>

<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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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=".soft1614080902204CActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp"
android:background="#FFFADC">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="你赢了!"
android:textStyle="bold"
android:textSize="100sp"/>
</LinearLayout>

</android.support.design.widget.CoordinatorLayout>
1 change: 1 addition & 0 deletions soft1614080902204/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<resources>
<string name="app_name">soft1614080902204</string>
<string name="title_activity_soft1614080902204_b">soft1614080902204BActivity</string>
<string name="title_activity_soft1614080902204_c">soft1614080902204CActivity</string>
</resources>
48 changes: 34 additions & 14 deletions soft1614080902204/report3.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
# 第3次实验

## 1、实验目的
1、掌握在Android应用中使用图片等资源的方法。
掌握在Android应用中使用图片等资源的方法。

## 2、实验环境
1、github
2、git
3、netbeans

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

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

(1)打开已建好的项目soft1614080902204

(2)新建activity:soft1614080902233BActivity

(3)在xml文件中插入代码

<TextView
android:id="@+id/textview_01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_launcher"
android:text="hello_world" />

这样就可以在布局中看到自己想要的图片

(4)在activity中写入相应的监听器代码

public class MainActivity extends Activity implements OnClickListener {
......

@Override
public void onClick(View v) {
if(v.equals(startButton)) {
// 另一个Activity的完整名称 = edu.androidlabs.soft123456(包名).Soft123456Activity(类名)
Intent intent = new Intent("另一个Activity的完整名称");
startActivity(intent);
}
}
}

(5)打包成apk文件运行成功,点图片跳转到第二个activity

## 5、实验结果
![实验截图](https://github.com/545072985/android-labs-2018/blob/master/soft1614080902204/tupian3.1.png)
Expand Down
39 changes: 39 additions & 0 deletions soft1614080902204/sy4/report4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 第4次实验

## 1、实验目的

(1)根据选题要求设计界面布局及控件使用;

(2)布局xml及界面控制操作代码提交并截图;

(3)将应用运行结果截图。


## 2、实验环境

windows、Android studio

## 3、实验目的

(1)打开已建好的项目soft1614080902204

(2)新建activity:soft1614080902233CActivity

(3)在xml文件中运用LinerLayout布局和TextView等进行我想象中的布局设置好

(4)在activity中写入相应的监听器代码

(5)打包成apk文件运行成功


## 5、实验结果

![实验截图](https://github.com/545072985/android-labs-2018/blob/master/soft1614080902204/sy4/tupian4.1.png)

![实验结果](https://github.com/545072985/android-labs-2018/blob/master/soft1614080902204/sy4/tupian4.2.png)

![实验结果](https://github.com/545072985/android-labs-2018/blob/master/soft1614080902204/sy4/tupian4.3.png)

## 6、实验总结

经过此次实验,我学会使用相应布局代码来进行xml文件布局,得到自己想要的模样,很开心。
Binary file added soft1614080902204/sy4/tupian4.1.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 soft1614080902204/sy4/tupian4.2.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 soft1614080902204/sy4/tupian4.3.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 3c20ff2

Please sign in to comment.