forked from hzuapps/android-labs-2019
-
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
11 changed files
with
325 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
students/com1714080901118/实验四/app/src/main/AndroidManifest.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,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.aishop"> | ||
|
||
<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=".DetailActivity" | ||
android:label="更多详情" | ||
android:theme="@style/AppTheme.NoActionBar"/> | ||
<activity | ||
android:name=".ShowActivity" | ||
android:label="商品详情" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
29 changes: 29 additions & 0 deletions
29
...901118/实验四/app/src/main/java/edu/hzuapps/androidlabs/Com1714080901118/DetailActivity.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,29 @@ | ||
package com.example.aishop; | ||
|
||
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 DetailActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_detail); | ||
Toolbar toolbar = findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
FloatingActionButton fab = 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(); | ||
} | ||
}); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...80901118/实验四/app/src/main/java/edu/hzuapps/androidlabs/Com1714080901118/MainActivity.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 com.example.aishop; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
private EditText et_name; | ||
private Button btn_send; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
et_name=(EditText)findViewById(R.id.et_name); | ||
btn_send=(Button)findViewById(R.id.btn_send); | ||
btn_send.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
passDate(); | ||
} | ||
}); | ||
} | ||
|
||
private void passDate() { | ||
Intent intent=new Intent(this,ShowActivity.class); | ||
intent.putExtra("the moon and sixpence",et_name.getText().toString().trim()); | ||
startActivity(intent); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...80901118/实验四/app/src/main/java/edu/hzuapps/androidlabs/Com1714080901118/ShowActivity.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,35 @@ | ||
package com.example.aishop; | ||
|
||
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.TextView; | ||
import org.w3c.dom.Text; | ||
|
||
public class ShowActivity extends AppCompatActivity { | ||
|
||
private TextView tv_name; | ||
private TextView textView; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_show); | ||
Intent intent=getIntent(); | ||
String name=intent.getStringExtra("the moon and sixpence"); | ||
tv_name=(TextView)findViewById(R.id.tv_name); | ||
tv_name.setText("bookname:"+name); | ||
textView=(TextView)findViewById(R.id.sp); | ||
textView.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent=new Intent(ShowActivity.this,DetailActivity.class); | ||
startActivity(intent); | ||
} | ||
}); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
students/com1714080901118/实验四/app/src/main/res/layout/activity_detail.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,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" | ||
android:background="@color/mycolor2" | ||
tools:context=".DetailActivity"> | ||
|
||
<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_detail" /> | ||
|
||
<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> |
59 changes: 59 additions & 0 deletions
59
students/com1714080901118/实验四/app/src/main/res/layout/activity_main.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,59 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout 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" | ||
android:background="@color/mycolor" | ||
tools:context=".MainActivity" | ||
android:orientation="vertical"> | ||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Welcome to AiShop" | ||
android:gravity="center" | ||
android:textSize="40dp" | ||
/> | ||
|
||
<LinearLayout | ||
android:id="@+id/regist_name" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginLeft="10dp" | ||
android:layout_marginTop="46dp" | ||
android:layout_marginRight="10dp" | ||
android:orientation="horizontal"> | ||
|
||
<TextView | ||
android:layout_width="80dp" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="right" | ||
android:text="Please enter" | ||
android:textSize="20dp" /> | ||
|
||
<EditText | ||
android:id="@+id/et_name" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="100dp" | ||
android:hint="请输入你要搜索的商品名" | ||
android:textSize="20dp" /> | ||
</LinearLayout> | ||
<Button | ||
android:id="@+id/btn_send" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginTop="100dp" | ||
android:text="搜索" | ||
/> | ||
|
||
<TextView | ||
android:id="@+id/shop" | ||
android:layout_width="600dp" | ||
android:layout_height="600dp" | ||
android:layout_alignTop="@+id/btn_send" | ||
android:layout_marginTop="34dp" | ||
android:drawableTop="@drawable/shop" /> | ||
</RelativeLayout> |
44 changes: 44 additions & 0 deletions
44
students/com1714080901118/实验四/app/src/main/res/layout/activity_show.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,44 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout 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" | ||
android:background="@color/mycolor2" | ||
tools:context=".ShowActivity" | ||
android:orientation="vertical" | ||
> | ||
|
||
<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> | ||
|
||
<TextView | ||
android:id="@+id/tv_name" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:layout_marginTop="10dp" | ||
android:textSize="20dp" | ||
tools:ignore="MissingConstraints" /> | ||
|
||
<TextView | ||
android:id="@+id/sp" | ||
android:layout_width="394dp" | ||
android:layout_height="621dp" | ||
android:drawableTop="@drawable/sp" | ||
android:text="¥24.80" | ||
android:textColor="@color/red" | ||
android:textSize="30dp" | ||
tools:ignore="MissingConstraints" /> | ||
</LinearLayout> |
37 changes: 37 additions & 0 deletions
37
students/com1714080901118/实验四/app/src/main/res/layout/content_detail.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,37 @@ | ||
<?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" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||
tools:context=".DetailActivity" | ||
tools:showIn="@layout/activity_detail"> | ||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="商品名称:月亮与六便士 | ||
作者:毛姆 著 | ||
ISBN号:9787533936020 | ||
出版社:浙江文艺出版社 | ||
版次:1 | ||
开本:32开 | ||
定价:39.80 | ||
出版时间:2017-01-10 | ||
印刷时间:2017-10-01 | ||
印次:7" | ||
android:textSize="30dp" | ||
tools:ignore="MissingConstraints" /> | ||
<ImageView | ||
android:id="@+id/xq" | ||
android:layout_width="600dp" | ||
android:layout_height="150dp" | ||
android:layout_marginTop="370dp" | ||
android:layout_marginBottom="50dp" | ||
android:scaleType="fitCenter" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:srcCompat="@drawable/xq" /> | ||
</android.support.constraint.ConstraintLayout> |
12 changes: 12 additions & 0 deletions
12
students/com1714080901118/实验四/app/src/main/res/layout/content_show.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,12 @@ | ||
<?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" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||
tools:context=".ShowActivity" | ||
tools:showIn="@layout/activity_show"> | ||
|
||
|
||
</android.support.constraint.ConstraintLayout> |
10 changes: 10 additions & 0 deletions
10
students/com1714080901118/实验四/app/src/main/res/values/colors.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,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary">#008577</color> | ||
<color name="colorPrimaryDark">#00574B</color> | ||
<color name="colorAccent">#D81B60</color> | ||
<color name="mycolor">#87ceeb</color> | ||
<color name="mycolor2">#deb887</color> | ||
<color name="red">#FF0000</color> | ||
<color name="black">#000000</color> | ||
</resources> |
5 changes: 5 additions & 0 deletions
5
students/com1714080901118/实验四/app/src/main/res/values/strings.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,5 @@ | ||
<resources> | ||
<string name="app_name">Aishop</string> | ||
<string name="title_activity_show">ShowActivity</string> | ||
<string name="title_activity_detail">DetailActivity</string> | ||
</resources> |