forked from hzuapps/android-labs-2018
-
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
8 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
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.
13 changes: 13 additions & 0 deletions
13
...4080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Main2Activity.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,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); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...4080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/Main3Activity.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,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(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...14080902124/app/src/main/java/edu/hzuapps/androidlabs/soft1614080902124/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,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); | ||
} | ||
}); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
soft1614080902124/soft1614080902124/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,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> |
34 changes: 34 additions & 0 deletions
34
soft1614080902124/soft1614080902124/app/src/main/res/layout/activity_main2.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,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> |
13 changes: 13 additions & 0 deletions
13
soft1614080902124/soft1614080902124/app/src/main/res/layout/activity_main3.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,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> |