Skip to content

Commit

Permalink
Merge pull request #907 from yingbabywhen/master
Browse files Browse the repository at this point in the history
#4 实验四
  • Loading branch information
zengsn authored Mar 24, 2019
2 parents 55fe98b + 3d89957 commit 595d8b5
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.hzuapps.androidlabs.soft1714080902309">

<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=".soft_1714080902309_activity3"
android:label="@string/title_activity_soft_1714080902309_activity3"></activity>
<activity
android:name=".Soft1714080902309Activity2"
android:label="@string/title_activity_soft_1714080902309_activity2" />
<activity android:name=".Soft1714080902309Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package edu.hzuapps.androidlabs.soft1714080902309;

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

public class Soft1714080902309Activity extends AppCompatActivity {

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

TextView btnOpen = (TextView) findViewById(R.id.textview_01);
btnOpen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Soft1714080902309Activity.this,Soft1714080902309Activity2.class));
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package edu.hzuapps.androidlabs.soft1714080902309;

import android.os.Bundle;
import android.app.Activity;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Soft1714080902309Activity2 extends Activity {
//定义要显示的书名和图片
private String[] bookname={"红楼梦","西游记","水浒传","三国演义",
"鲁宾逊飘流记","简·爱","傲慢与偏见","钢铁是怎样炼成的"};
private int[] imageId={R.drawable.rendream,R.drawable.westtrave,R.drawable.water,R.drawable.threecountry,
R.drawable.lulutrave,R.drawable.jianai,R.drawable.and,R.drawable.howto};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.soft_1714080902309_activity2);
//获取activity中的listview对象
ListView listView =(ListView) findViewById(R.id.listview);
//定义一个适配器对象list_map
List<Map<String,Object>> list_map = new ArrayList<Map<String,Object>>();
for (int i=0;i<bookname.length;i++){
//创建一个键值对的Map集合pr,用来存放名字和头像
Map<String,Object> pr = new HashMap<String,Object>();
pr.put("fengmian",imageId[i]);
pr.put("name",bookname[i]);
//把这个存放好数据的Map集合-pr,放入到list(list_map)中
list_map.add(pr);
}

SimpleAdapter simplead = new SimpleAdapter(this,list_map,R.layout.soft_1714080902309_activity3,new String[]{"name","fengmian"},new int[]{R.id.name,R.id.fegmian});
ListView lis1 =(ListView)findViewById(R.id.listview);
lis1.setAdapter(simplead);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package edu.hzuapps.androidlabs.soft1714080902309;

import android.os.Bundle;
import android.app.Activity;

public class soft_1714080902309_activity3 extends Activity {

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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"
tools:context=".Soft1714080902309Activity"
android:orientation="vertical">


<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="49dp"
android:gravity="center"
android:text="本机书籍列表" />


<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="23dp"
android:layout_marginTop="120dp"
android:gravity="center"
android:text="没有更多书籍了"/>

<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="23dp"
android:layout_marginTop="50dp"
android:gravity="center"
android:text="点击右下角导入本机书籍"/>

<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="23dp"
android:gravity="center"
android:text="点击下方进入网络书城"
android:layout_marginTop="30dp" />


<TextView
android:id="@+id/textview_01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:clickable="true"
android:drawableTop="@drawable/tupian"
android:gravity="center"
android:text="进入书城" />

<Button
android:id="@+id/button"
android:layout_width="65dp"
android:layout_marginTop="50dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="+"
tools:ignore="RtlHardcoded" />


</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
tools:context=".Soft1714080902309Activity2"
android:orientation="vertical">

<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="49dp"
android:gravity="center"
android:text="网络书城" />


<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>


</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
tools:context=".soft_1714080902309_activity3">

<ImageView
android:id="@+id/fegmian"
android:layout_width="80dp"
android:layout_height="50dp"
android:paddingLeft="10dp"/>

<TextView
android:id="@+id/name"
android:textColor="#FFCC00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"/>

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<string name="app_name">shiyan3</string>
<string name="title_activity_soft_1714080902309_activity2">soft_1714080902309_activity2</string>
<string name="title_activity_soft_1714080902309_activity3">soft_1714080902309_activity3</string>
</resources>
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.

0 comments on commit 595d8b5

Please sign in to comment.