Skip to content

Commit

Permalink
hzuapps#5 hzuapps#891 第五次实验
Browse files Browse the repository at this point in the history
  • Loading branch information
BoyJDG committed May 31, 2018
1 parent 853d63c commit ef48983
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 0 deletions.
Binary file added soft1614080902124/shiyan5 (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 soft1614080902124/shiyan5.jpg
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,13 @@
package edu.hzuapps.androidlabs.soft1614080902124;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class Main2Activity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package edu.hzuapps.androidlabs.soft1614080902124;

import android.content.res.Resources;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Scanner;

public class Main3Activity extends AppCompatActivity {
public ArrayList<String> data = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);

load();
ListView listView=(ListView) findViewById(R.id.listview);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(Main3Activity.this,android.R.layout.simple_list_item_1,data);
listView.setAdapter(adapter);
}

public void load() {
Resources resources = this.getResources();
InputStream StdInfo = null;
try {
// 用InputStream方式读取保存在 /res/raw 下的原始文件
StdInfo = resources.openRawResource(R.raw.data);
if (StdInfo.available() == 0)
return;
if (StdInfo != null) {
//用utf-8读取文件
Scanner input = new Scanner(StdInfo, "GBK");
while (input.hasNext()) {
String Name = input.next();
data.add(Name);
}
}

} catch (Exception e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package edu.hzuapps.androidlabs.soft1614080902124;

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 {

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

Button button1 = (Button) findViewById(R.id.two);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, Main3Activity.class);
startActivity(intent);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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="@drawable/pic2"
tools:context="edu.hzuapps.androidlabs.soft1614080902124.MainActivity">

<Button
android:id="@+id/my_in"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_above="@+id/two"
android:layout_centerHorizontal="true"
android:layout_marginBottom="82dp"
android:text="进入照片浏览系统"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/two"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="159dp"
android:text="查看图片数据" />

</RelativeLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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="@drawable/pic1"
tools:context="edu.hzuapps.androidlabs.soft1614080902124.Main2Activity">


<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mypic"
/>

<Button
android:id="@+id/pre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="下一张"
tools:layout_editor_absoluteX="41dp"
tools:layout_editor_absoluteY="411dp" />

<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上一张"
tools:layout_editor_absoluteX="245dp"
tools:layout_editor_absoluteY="411dp" />
</RelativeLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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.soft1614080902124.Main3Activity">

<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listview"/>
</android.support.constraint.ConstraintLayout>

0 comments on commit ef48983

Please sign in to comment.