登录注册页面构建源码

 

MainActivity.java

package com.example.adwareexpand;

import com.example.enroll.EnrollActivity;
import com.example.login.LoginActivity;

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

public class MainActivity extends Activity {

private Button enorllButton;
private Button loginButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
enorllButton = (Button) findViewById(R.id.enorll_btn);
enorllButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,
EnrollActivity.class);
startActivity(intent);
}
});

loginButton = (Button) findViewById(R.id.login_btn);
loginButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,
LoginActivity.class);
startActivity(intent);
}
});
}

}

activity_main.xml

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="十七"
android:textSize="60dp"
android:textColor="#3399FF"
android:layout_marginTop="100dp"
android:layout_gravity="center_horizontal"/>

转载于:https://www.cnblogs.com/shmilyGWT/p/5736368.html

你可能感兴趣的:(登录注册页面构建源码)