Skip to content

Commit

Permalink
#95 #210 lab9
Browse files Browse the repository at this point in the history
完成整个实验
  • Loading branch information
pilimachao committed Jun 20, 2016
1 parent 4597b32 commit f8375b3
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.yaoyiyao;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button1=(Button)findViewById(R.id.button);
Button button2=(Button)findViewById(R.id.button2);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent();
i.setClass(MainActivity.this,Shark.class);
startActivity(i);
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MainActivity.this.finish();
}
});
}

}
Binary file added app/src/main/res/drawable-hdpi/ic_launcher.png
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 app/src/main/res/drawable-hdpi/me.png
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 app/src/main/res/drawable-hdpi/shake_bottom.png
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 app/src/main/res/drawable-hdpi/shake_bottom_line.png
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 app/src/main/res/drawable-hdpi/shake_top.png
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 app/src/main/res/drawable-hdpi/shake_top_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions app/src/main/res/layout/activity_main (2).xml
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:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:background="@drawable/base_bg">


<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开始游戏"
android:id="@+id/button"
android:textSize="30dp"
android:textColor="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="149dp"
android:background="#00000000"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="结束游戏"
android:id="@+id/button2"
android:textSize="30dp"
android:textColor="#FFFFFF"
android:layout_below="@+id/button"
android:layout_centerHorizontal="true"
android:layout_marginTop="101dp"
android:background="#00000000"/>
</RelativeLayout>
66 changes: 66 additions & 0 deletions app/src/main/res/layout/shark_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!--摇一摇下面的背景图-->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/me"
/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical" >

<LinearLayout
android:id="@+id/shake_top_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="vertical" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:src="@drawable/shake_top" />

<ImageView
android:id="@+id/shake_top_line"
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/shake_top_line" />
</LinearLayout>

<LinearLayout
android:id="@+id/shake_bottom_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="vertical" >

<ImageView
android:id="@+id/shake_bottom_line"
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/shake_bottom_line" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:src="@drawable/shake_bottom" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

</LinearLayout>

0 comments on commit f8375b3

Please sign in to comment.