forked from hzuapps/android-labs-2017
-
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
4 changed files
with
95 additions
and
92 deletions.
There are no files selected for viewing
51 changes: 0 additions & 51 deletions
51
.../main/java/edu/hzuapps/androidlabs/homeworks/net1412070501227/Net1412070501227Commit.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...n/java/edu/hzuapps/androidlabs/homeworks/net1412070501227/Net1412070501227OpenHelper.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...c/main/java/edu/hzuapps/androidlabs/homeworks/net1412070501227/Net1412070501227login.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,45 @@ | ||
package edu.hzuapps.androidlabs.homeworks.net1412070501227; | ||
|
||
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; | ||
import android.widget.Toast; | ||
|
||
import edu.hzuapps.androidlabs.R; | ||
|
||
|
||
public class Net1412070501227login extends AppCompatActivity { | ||
private EditText username; | ||
private EditText password; | ||
private Button login; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_net1412070501227_login); | ||
|
||
username = (EditText)findViewById(R.id.editText); | ||
password = (EditText)findViewById(R.id.editText2); | ||
login = (Button)findViewById(R.id.button); | ||
|
||
login.setOnClickListener(new View.OnClickListener(){ | ||
@Override | ||
public void onClick(View v){ | ||
String name = username.getText().toString(); | ||
String pwd = password.getText().toString(); | ||
|
||
if("livehan".equals(name) | ||
&& "liweihan1".equals(pwd)){ | ||
Intent intent = new Intent(Net1412070501227login.this,Net1412070501227index.class); | ||
startActivity(intent); | ||
}else{ | ||
Toast.makeText(Net1412070501227login.this,"账号或密码错误", | ||
Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
}); | ||
} | ||
} |
66 changes: 50 additions & 16 deletions
66
AndroidLabs/app/src/main/res/layout/activity_net1412070501227_index.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 |
---|---|---|
@@ -1,47 +1,81 @@ | ||
<?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:id="@+id/activity_index_net1412070501227" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:background="@drawable/qiche" | ||
tools:context="edu.hzuapps.androidlabs.homeworks.net1412070501227.Net1412070501227index"> | ||
android:paddingTop="@dimen/activity_vertical_margin"> | ||
|
||
|
||
<Button | ||
android:text="首页" | ||
android:id="@+id/index" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_alignParentLeft="true" | ||
android:layout_alignParentStart="true" | ||
android:layout_marginLeft="14dp" | ||
android:layout_marginStart="14dp" | ||
android:id="@+id/index" /> | ||
android:text="首页" /> | ||
|
||
<Button | ||
android:text="购物车" | ||
android:id="@+id/btn_cart" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:id="@+id/btn_cart" | ||
android:layout_alignParentBottom="true" | ||
android:layout_toRightOf="@+id/index" | ||
android:layout_toEndOf="@+id/index" | ||
android:layout_marginLeft="28dp" | ||
android:layout_marginStart="28dp" /> | ||
android:layout_marginStart="28dp" | ||
android:layout_toEndOf="@+id/index" | ||
android:layout_toRightOf="@+id/index" | ||
android:text="购物车" /> | ||
|
||
<Button | ||
android:text="登陆" | ||
android:id="@+id/btn_login" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginRight="22dp" | ||
android:layout_marginEnd="22dp" | ||
android:id="@+id/btn_login" | ||
android:layout_alignParentBottom="true" | ||
android:layout_alignParentEnd="true" | ||
android:layout_alignParentRight="true" | ||
android:layout_alignParentEnd="true" /> | ||
android:layout_marginEnd="22dp" | ||
android:layout_marginRight="22dp" | ||
android:text="登陆" /> | ||
|
||
<ScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<ImageView | ||
android:id="@+id/iv1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/one" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/two" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv3" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/three" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv4" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/four" /> | ||
</LinearLayout> | ||
|
||
</ScrollView> | ||
|
||
</RelativeLayout> |