Skip to content

Commit

Permalink
hzuapps#2 hzuapps#93 第二次作业
Browse files Browse the repository at this point in the history
  • Loading branch information
livehan committed Jun 14, 2017
1 parent da85108 commit a7d0e8f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 92 deletions.

This file was deleted.

This file was deleted.

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();
}
}
});
}
}
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>

0 comments on commit a7d0e8f

Please sign in to comment.