Skip to content

Commit

Permalink
Merge pull request #1869 from heyingsen/master
Browse files Browse the repository at this point in the history
 #4 #984 第四次实验
  • Loading branch information
zengsn authored May 13, 2018
2 parents 41a85b6 + ca42e09 commit bc30d89
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 0 deletions.
64 changes: 64 additions & 0 deletions soft1614080902302/Fourth/activity_soft1614080902302.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?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="edu.hzuapps.androidlabs.a123.MainActivity">

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="快递查询系统"
android:textSize="40sp"
android:textColor="#000000"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="20dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>


<TextView
android:id="@+id/user_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="快递单号:"
android:textColor="#000000"
android:textSize="18sp"
tools:layout_editor_absoluteX="20dp"
tools:layout_editor_absoluteY="219dp" />

<EditText
android:id="@+id/text_userid"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:digits="0123456789"
android:hint="请输入快递单号"
android:paddingTop="0dp"
android:textColor="#000000"
android:textSize="18sp"
app:layout_constraintHorizontal_bias="0.975"
app:layout_constraintLeft_toRightOf="@+id/user_id"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/user_id" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查询"
tools:layout_editor_absoluteX="39dp"
tools:layout_editor_absoluteY="319dp" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="退出"
tools:layout_editor_absoluteX="222dp"
tools:layout_editor_absoluteY="319dp" />


</android.support.constraint.ConstraintLayout>
33 changes: 33 additions & 0 deletions soft1614080902302/Fourth/activity_soft16140809023022.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=".Main2Activity">

<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_main2" />

<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>
Binary file added soft1614080902302/Fourth/img2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package edu.hzuapps.androidlabs.soft1614080902302;

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.view.Menu;
import android.view.MenuItem;
import android.widget.Button;

public class soft1614080902302Activity extends AppCompatActivity {
Button button1;
Button button2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
button1=(Button)findViewById(R.id.button1);
button1.setOnClickListener((View.OnClickListener)this);
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();
Intent intent=new Intent(soft1614080902302Activity2.this,soft1614080902302Activity.class);
thisActivity.starACtivity(intent);
}
});
}

@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_main, 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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package edu.hzuapps.androidlabs.soft1614080902302Activity2;

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 soft1614080902302Activity2 extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) 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();
}
});
}

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

## 1.实验目标

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

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

3.将应用运行结果截图。(不要做登录注册!)

## 2.实验要求

1.使用其中一种布局方式,设计所选题目的界面;

2.通过控件ID获取界面对象,执行相关操作;

3.实现界面控件的事件处理,例如点击按钮;

## 3.实验步骤

1.首先设计出想要写出的界面雏形。

2.再根据布局往xml中添加控件。

3.通过代码处添加layout布局或可视化界面处移动控件来实现具体布局。

## 4. 实验结果

![image](https://github.com/heyingsen/android-labs-2018/blob/master/soft1614080902302/Fourth/tupian3.png)

![image](https://github.com/heyingsen/android-labs-2018/blob/master/soft1614080902302/Fourth/tupian4.png)

这次实验提高了我的应用程序界面设计的能力,首先要为自己所想要建造的APP选择合适的界面布局,我选择LinearLayout线型。LinearLayout布局容器内的组件一个挨着一个地排列起来:可以控制个组件横向排列,也可控制各组件纵向排列。通过orientation属性设置线性排列的方向是垂直(vertical)还是纵向(horizontal)。
然后通过控件按钮来监测界面对象,实现相关跳转。
Binary file added soft1614080902302/Fourth/tupian3.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 soft1614080902302/Fourth/tupian4.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 bc30d89

Please sign in to comment.