parent
fe8f4b8b21
commit
1f60ac8f80
@ -1,14 +0,0 @@
|
||||
package com.example.story;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.example.story.view.activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.example.story.R;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
Button login_btn;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
login_btn=(Button)findViewById(R.id.btn_login);
|
||||
login_btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent =new Intent(MainActivity.this,HomeActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
//public class MainActivity extends AppCompatActivity {
|
||||
// private SharedPreferences preferences;
|
||||
// private SharedPreferences .Editor editor;
|
||||
// private EditText NameEdit;
|
||||
// private EditText PasswordEdit;
|
||||
// private Button login;
|
||||
// private CheckBox remember;
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// setContentView(R.layout.activity_main);
|
||||
//
|
||||
// preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
// NameEdit = (EditText) findViewById(R.id.Name);
|
||||
// PasswordEdit = (EditText) findViewById(R.id.Password);
|
||||
// remember = (CheckBox) findViewById(R.id.remember);
|
||||
// login = (Button) findViewById(R.id.login);
|
||||
// boolean isRemember = preferences.getBoolean("remember_password",false);
|
||||
// if (isRemember){
|
||||
// String Name = preferences.getString("Name","");
|
||||
// String Password = preferences.getString("Password","");
|
||||
// NameEdit.setText(Name);
|
||||
// PasswordEdit.setText(Password);
|
||||
// remember.setChecked(true);
|
||||
// }
|
||||
// login.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// String Name = NameEdit.getText().toString();
|
||||
// String Password = PasswordEdit.getText().toString();
|
||||
// if (TextUtils.isEmpty(NameEdit.getText().toString()) || TextUtils.isEmpty(PasswordEdit.getText().toString())) {
|
||||
// Toast.makeText(MainActivity.this, "用户名或者密码不能为空", Toast.LENGTH_SHORT).show();
|
||||
// } else
|
||||
// if(Name.equals("CSDN")&&Password.equals("12345678")){
|
||||
// editor = preferences.edit();
|
||||
// if(remember.isChecked()){
|
||||
// editor.putBoolean("remember_password",true);
|
||||
// editor.putString("Name",Name);
|
||||
// editor.putString("Password",Password);
|
||||
// }else{editor.clear();}
|
||||
// editor.apply();
|
||||
// Intent intent = new Intent(MainActivity.this,Receiver.class);
|
||||
// intent.putExtra("Name",Name);
|
||||
// intent.putExtra("Password",Password);
|
||||
// startActivity(intent);
|
||||
// Toast.makeText(MainActivity.this,"登录成功",Toast.LENGTH_SHORT).show();
|
||||
// finish();
|
||||
// }else {Toast.makeText(MainActivity.this,"账号密码错误",Toast.LENGTH_SHORT).show();}
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//}
|
@ -1,18 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
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=".MainActivity">
|
||||
|
||||
android:orientation="vertical"
|
||||
tools:context=".view.activity.MainActivity">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="35dp">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/symbol">
|
||||
</ImageView>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="wz!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
android:text="宝宝巴逝登入界面"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="20sp"></TextView>
|
||||
<EditText
|
||||
android:id="@+id/et_user_name"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="60dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:hint="账号">
|
||||
</EditText>
|
||||
<EditText
|
||||
android:id="@+id/et_psw"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:hint="密码">
|
||||
</EditText>
|
||||
<Button
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="登入"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:id="@+id/btn_login"
|
||||
android:background="#1E90FF"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="24sp">
|
||||
</Button>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="80dp"
|
||||
android:text="欢迎来到猛男网咖">
|
||||
</TextView>
|
||||
</LinearLayout>
|
Loading…
Reference in new issue