Skip to content

Commit

Permalink
Merge pull request #2403 from chinesehope/master
Browse files Browse the repository at this point in the history
#3 第三次实验
  • Loading branch information
zengsn authored May 29, 2018
2 parents 0794084 + c77dcb5 commit ea22346
Show file tree
Hide file tree
Showing 11 changed files with 246 additions and 0 deletions.
26 changes: 26 additions & 0 deletions soft1614080902345/App/Java/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.administrator;

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

public class MainActivity extends AppCompatActivity {
private Button runbutton;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
runbutton=(Button) findViewById(R.id.button);
runbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent =new Intent(MainActivity.this,RunActivity.class);
startActivity(intent);
}
});

}
}
17 changes: 17 additions & 0 deletions soft1614080902345/App/Java/RunActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.administrator;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class RunActivity extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.run);




}
}
29 changes: 29 additions & 0 deletions soft1614080902345/App/Main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator">

<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=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RunActivity"
android:screenOrientation="portrait"
android:label="@string/run_name">

</activity>
</application>

</manifest>
22 changes: 22 additions & 0 deletions soft1614080902345/App/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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=".MainActivity"
android:background="@drawable/bg"
android:label="@string/app_name"
>


<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="进入兼职"
android:textSize="16sp"
tools:layout_editor_absoluteX="159dp"
tools:layout_editor_absoluteY="284dp"
tools:ignore="MissingConstraints" />
</android.support.constraint.ConstraintLayout>
91 changes: 91 additions & 0 deletions soft1614080902345/App/res/layout/run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">

<EditText
android:layout_width="280dp"
android:layout_height="50dp"
android:hint="请输入搜索字样"
android:gravity="left"
android:layout_marginTop="5dp"/>

<Button
android:id="@+id/button2"
android:layout_width="100dp"
android:layout_height="50dp"
android:text="搜索"
android:layout_marginRight="0dp"
/>


</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="115dp"
android:background="@drawable/a1">


<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="兼职一"
android:textSize="50sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="115dp"
android:background="@drawable/a1">

<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="兼职二"
android:textSize="50sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="115dp"
android:background="@drawable/a1">

<Button
android:id="@+id/button5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="兼职三"
android:textSize="50sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="115dp"
android:background="@drawable/a1">

<Button
android:id="@+id/button6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="兼职四"
android:textSize="50sp"/>
</LinearLayout>

</LinearLayout>



</android.support.constraint.ConstraintLayout>
4 changes: 4 additions & 0 deletions soft1614080902345/App/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<string name="app_name">小兼职</string>
<string name="run_name">兼职页面</string>
</resources>
27 changes: 27 additions & 0 deletions soft1614080902345/report3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 第三次实验

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

## 2、实验步骤
1. 在界面上显示至少一张图片,该图片我用背景方式显示;

2.提交res/drawable及图片使用的代码;

3.提交res/values, res/layout等其他代码;

4.将应用运行结果截图,放到实验报告中;

5.点击图片(或按钮)时,打开另一个Activity。


## 3、实验结果
我的Android应用第一个activity截图。
![在Android SDK Manager中选择6.0库](https://raw.githubusercontent.com/chinesehope/android-labs-2018/master/soft1614080902345/%E5%AE%9E%E9%AA%8C3%E6%88%AA%E5%9B%BE1.jpg "配置教育网下载代理")

点击按钮后跳转的activity.
![在Android SDK Manager中选择6.0库](https://raw.githubusercontent.com/chinesehope/android-labs-2018/master/soft1614080902345/%E5%AE%9E%E9%AA%8C3%E6%88%AA%E5%9B%BE2.jpg "配置教育网下载代理")

## 4、实验体会
1. 这个实验需要用到虚拟机显示,需要在电脑上先下载
2. 在实现跳转的时候我用了INTENT意向,采用的是内部类的方法
30 changes: 30 additions & 0 deletions soft1614080902345/report4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 第四次实验

## 1、实验要求
1、根据自己的选题要求设计界面布局及控件使用;
2、布局xml及界面控制操作代码提交并截图;
3、将应用运行结果截图。

## 2、实验步骤
1.这个实验是用通过布局放置好控件,所以在上一个实验的基础的跳转后的RunActivity中修改代码

2.通过网上查找布局方法,根据我自己的APP的实际情况我采用的是线性布局Linearlayout,通过多个Linearlayout布局的嵌套
以及对垂直分布属性和水平分布属性来放置自己的控件,我的这个实验通过以Button为例子替代原本应该是数据库存储的兼职信息。

3.提交res/values, res/layout等其他代码;

4.将应用运行结果截图,放到实验报告中;



## 3、实验结果
我的Android应用第一个activity截图。
![在Android SDK Manager中选择6.0库](https://raw.githubusercontent.com/chinesehope/android-labs-2018/master/soft1614080902345/%E5%AE%9E%E9%AA%8C3%E6%88%AA%E5%9B%BE1.jpg "配置教育网下载代理")

点击按钮后跳转的activity.
![在Android SDK Manager中选择6.0库](https://raw.githubusercontent.com/chinesehope/android-labs-2018/master/soft1614080902345/%E5%AE%9E%E9%AA%8C4%E6%88%AA%E5%9B%BE1.jpg "配置教育网下载代理")

## 4、实验体会
1. 这个实验的布局其实有多种方法,我采用的是线性布局通过嵌套和控制margin间距来使页面看起来更好看点。
2. 布局中可以使用gravity来控制同一个布局下不同控件应该在的位置,bottom,left,或者right
3. 可以通过不同的布局来实现好看的视觉效果,比如线性布局嵌套表格布局,所以布局是多变的。
Binary file added soft1614080902345/实验3截图1.jpg
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 soft1614080902345/实验3截图2.jpg
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 soft1614080902345/实验4截图1.jpg
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 ea22346

Please sign in to comment.