-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2408 from lin1085271231/master
#3 第三次实验
- Loading branch information
Showing
15 changed files
with
386 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
soft1614080902308/app/java/Soft16140809023082Activity.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,31 @@ | ||
package edu.hzuapps.androidlabs.soft1614080902308; | ||
|
||
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 com.example.admin.soft1614080902308.R; | ||
|
||
public class Soft16140809023082Activity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_soft16140809023082); | ||
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(); | ||
} | ||
}); | ||
} | ||
|
||
} |
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,43 @@ | ||
package edu.hzuapps.androidlabs.soft1614080902308; | ||
|
||
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; | ||
|
||
import com.example.admin.soft1614080902308.R; | ||
|
||
public class Soft1614080902308Activity extends AppCompatActivity implements View.OnClickListener{ | ||
|
||
private Button button_open; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_soft1614080902308); | ||
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(); | ||
} | ||
}); | ||
button_open=(Button)findViewById(R.id.button_open); | ||
button_open.setOnClickListener(this); | ||
|
||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(Soft1614080902308Activity.this,edu.hzuapps.androidlabs.soft1614080902308.Soft16140809023082Activity.class); | ||
this.startActivity(intent); | ||
} | ||
} |
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
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions
47
soft1614080902308/app/res/layout/activity_soft1614080902308.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,47 @@ | ||
<?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="edu.hzuapps.androidlabs.soft1614080902308.Soft1614080902308Activity"> | ||
|
||
<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_soft1614080902308" /> | ||
|
||
<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" /> | ||
|
||
<TextView | ||
android:id="@+id/textView2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:drawableTop="@drawable/background" | ||
android:text="" /> | ||
|
||
<Button | ||
android:id="@+id/button_open" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="60dp" | ||
android:text="开始点餐"/> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
144 changes: 144 additions & 0 deletions
144
soft1614080902308/app/res/layout/activity_soft16140809023082.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,144 @@ | ||
<?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="edu.hzuapps.androidlabs.soft1614080902308.Soft16140809023082Activity"> | ||
|
||
<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_soft16140809023082" /> | ||
|
||
<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" /> | ||
|
||
|
||
<Button | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="60dp" | ||
android:text="输入商家、商品名称" /> | ||
|
||
|
||
<LinearLayout | ||
android:id="@+id/main_bottom_bar" | ||
android:layout_width="match_parent" | ||
android:layout_height="55dp" | ||
android:layout_alignParentBottom="true" | ||
android:background="#F2F2F2" | ||
android:orientation="horizontal" | ||
android:layout_marginTop="510dp" | ||
> | ||
|
||
<RelativeLayout | ||
android:id="@+id/bottom_bar_home_btn" | ||
android:layout_width="0dp" | ||
android:layout_height="fill_parent" | ||
android:layout_weight="1"> | ||
|
||
<TextView | ||
android:id="@+id/bottom_bar_text_home" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="3dp" | ||
android:gravity="center" | ||
android:singleLine="true" | ||
android:text="首页" | ||
android:textColor="#666666" | ||
android:textSize="14sp" /> | ||
|
||
<ImageView | ||
android:id="@+id/bottom_bar_image_home" | ||
android:layout_width="27dp" | ||
android:layout_height="27dp" | ||
android:layout_above="@+id/bottom_bar_text_home" | ||
android:layout_alignParentTop="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginTop="3dp" | ||
android:src="@drawable/main_home_icon" /> | ||
</RelativeLayout> | ||
|
||
<RelativeLayout | ||
android:id="@+id/bottom_bar_list_btn" | ||
android:layout_width="0dp" | ||
android:layout_height="fill_parent" | ||
android:layout_weight="1"> | ||
|
||
<TextView | ||
android:id="@+id/bottom_bar_text_list" | ||
android:layout_width="127dp" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="3dp" | ||
android:gravity="center" | ||
android:singleLine="true" | ||
android:text="订单" | ||
android:textColor="#666666" | ||
android:textSize="14sp" /> | ||
|
||
<ImageView | ||
android:id="@+id/bottom_bar_image_list" | ||
android:layout_width="27dp" | ||
android:layout_height="27dp" | ||
android:layout_above="@+id/bottom_bar_text_list" | ||
android:layout_alignParentTop="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginTop="3dp" | ||
android:src="@drawable/main_list_icon" /> | ||
</RelativeLayout> | ||
|
||
<RelativeLayout | ||
android:id="@+id/bottom_bar_myself_btn" | ||
android:layout_width="0dp" | ||
android:layout_height="fill_parent" | ||
android:layout_weight="1"> | ||
|
||
<TextView | ||
android:id="@+id/bottom_bar_text_myself" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="3dp" | ||
android:gravity="center" | ||
android:singleLine="true" | ||
android:text="个人中心" | ||
android:textColor="#666666" | ||
android:textSize="14sp" /> | ||
|
||
<ImageView | ||
android:id="@+id/bottom_bar_image_myself" | ||
android:layout_width="27dp" | ||
android:layout_height="27dp" | ||
android:layout_above="@+id/bottom_bar_text_myself" | ||
android:layout_alignParentTop="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginTop="3dp" | ||
android:src="@drawable/main_myself_icon" /> | ||
</RelativeLayout> | ||
</LinearLayout> | ||
|
||
|
||
|
||
</android.support.design.widget.CoordinatorLayout> |
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,7 @@ | ||
<resources> | ||
<string name="app_name">Soft1614080902308-外卖点餐</string> | ||
<string name="title_home">Home</string> | ||
<string name="title_dashboard">Dashboard</string> | ||
<string name="title_notifications">Notifications</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,28 @@ | ||
# 第三次实验 | ||
|
||
## 1.实验目标 | ||
掌握在Android应用中使用图片等资源的方法。 | ||
|
||
## 2.实验步骤 | ||
|
||
* (1)在原先创的项目中增加一个Activity。 | ||
|
||
* (2)在界面中显示一张图片。 | ||
|
||
* (3)在主界面中加一按钮。 | ||
|
||
* (4) 在soft1614080902308Activity.java里加一个按扭触发事件。 | ||
|
||
* (5)把代码提交到Github。 | ||
|
||
* (6)将应用运行结果截图,放到实验报告中 | ||
|
||
## 3实验结果 | ||
|
||
![image](https://github.com/lin1085271231/android-labs-2018/blob/master/soft1614080902308/%E7%AC%AC3%E6%AC%A1%E5%AE%9E%E9%AA%8C%E5%9B%BE%E7%89%871.PNG) | ||
|
||
![image](https://github.com/lin1085271231/android-labs-2018/blob/master/soft1614080902308/%E7%AC%AC3%E6%AC%A1%E5%AE%9E%E9%AA%8C%E5%9B%BE%E7%89%872.PNG) | ||
|
||
## 4实验体会 | ||
|
||
现在来做的话这个实验总体来说不会很难,可当时做的时候并不知道要怎样做才好,总得来说,自己相比以前进步了不少。 |
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,47 @@ | ||
#1.实验要求 | ||
|
||
|
||
1)根据选题要求设计界面布局及控件使用; | ||
|
||
|
||
2)布局xml及界面控制操作代码提交并截图; | ||
|
||
|
||
3)将应用运行结果截图。 | ||
|
||
# 2.实验内容 | ||
|
||
|
||
1)使用其中一种布局方式 ; | ||
|
||
|
||
2)通过控件id获取界面对象,执行相关操作; | ||
|
||
|
||
3)实现界面控件的事件处理,例如点击按钮。 | ||
|
||
|
||
# 3.实验步骤 | ||
|
||
|
||
(1)在xml文件中使用线性布局linearlayout; | ||
|
||
|
||
(2)新设计两个button; | ||
|
||
|
||
(3)运行,截图,把图片用git上传到自己的库中; | ||
|
||
|
||
(4)写实验报告,提交; | ||
|
||
|
||
# 4.实验结果 | ||
|
||
|
||
![image](https://github.com/lin1085271231/android-labs-2018/blob/master/soft1614080902308/%E5%AE%9E%E9%AA%8C4%E5%9B%BE%E7%89%87.PNG) | ||
|
||
|
||
# 5.实验体会 | ||
|
||
此次实验较前几次难点,不过通过查看书籍和看视频,基本掌握几种布局和通过控件id获取界面对象的方法。 |
Oops, something went wrong.