加入登录功能实现,数据访问
This commit is contained in:
parent
3b730fe35b
commit
0856c27e1d
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -45,4 +45,9 @@ dependencies {
|
|||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
implementation ("com.geyifeng.immersionbar:immersionbar:3.2.2")
|
||||
implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2")
|
||||
implementation("com.squareup.okhttp3:okhttp:4.11.0")
|
||||
implementation ("com.google.code.gson:gson:2.10.1")
|
||||
implementation ("com.squareup.okhttp3:logging-interceptor:4.9.3")
|
||||
implementation ("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
implementation ("com.squareup.retrofit2:converter-gson:2.9.0")
|
||||
}
|
|
@ -11,12 +11,24 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Liyueling"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity android:name=".MainActivity"
|
||||
android:exported="false"/>
|
||||
<activity android:name=".LoginMainActivity"
|
||||
android:exported="false"/>
|
||||
<activity android:name=".SpActivity"
|
||||
android:exported="false"/>
|
||||
<activity
|
||||
android:name=".ChangePasswordActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ForgetPasswordActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".EnrollActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".LoginMainActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".SpActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".welcome"
|
||||
android:exported="true">
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ChangePasswordActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_change_password);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class EnrollActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
EditText phone;
|
||||
EditText password;
|
||||
EditText repassword;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_enroll);
|
||||
|
||||
findViewById(R.id.enter).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
String phoneNumber = phone.getText().toString();
|
||||
String userPassword = password.getText().toString();
|
||||
String reuserPassword = repassword.getText().toString();
|
||||
|
||||
if (phoneNumber.isEmpty() || userPassword.isEmpty() || reuserPassword.isEmpty()) {
|
||||
Toast.makeText(EnrollActivity.this, "内容不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!userPassword.equals(reuserPassword)) {
|
||||
Toast.makeText(EnrollActivity.this, "两次输入密码不同", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
userApi api2 = RetrofitUtils.getRetrofit("https://dev.usemock.com/664ac0559e857b0cdafce629/").create(userApi.class);
|
||||
try {
|
||||
Call<User> call = api2.Enroll(phoneNumber,userPassword);
|
||||
call.enqueue(new Callback<User>() {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
User user = response.body();
|
||||
if (user != null && user.password.equals(userPassword)) {
|
||||
Intent intent = new Intent(EnrollActivity.this, LoginMainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
// 注册失败
|
||||
Toast.makeText(EnrollActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
Toast.makeText(EnrollActivity.this, "Network error", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e("YourTag", "Error occurred: " + e.getMessage()); // 打印异常信息
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
findViewById(R.id.textView174).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(EnrollActivity.this,LoginMainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ForgetPasswordActivity extends AppCompatActivity {
|
||||
|
||||
EditText yanzhen;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_forget_password);
|
||||
yanzhen = findViewById(R.id.password1);
|
||||
|
||||
findViewById(R.id.fasong).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(ForgetPasswordActivity.this, "239546", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.enter).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(yanzhen.getText().toString().equals("239546")){
|
||||
Intent intent = new Intent(ForgetPasswordActivity.this, ChangePasswordActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(ForgetPasswordActivity.this, "验证码错误", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -3,28 +3,99 @@ package com.example.liyueling_final;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class LoginMainActivity extends AppCompatActivity {
|
||||
|
||||
private RadioButton radioButton;
|
||||
EditText phone;
|
||||
EditText password;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login_main);
|
||||
radioButton = findViewById(R.id.radioButton);
|
||||
phone = findViewById(R.id.phone);
|
||||
password = findViewById(R.id.password1);
|
||||
|
||||
|
||||
findViewById(R.id.enter).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("user",MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean("isLogin",true);
|
||||
editor.commit();
|
||||
|
||||
Intent intent = new Intent(LoginMainActivity.this,MainActivity.class);
|
||||
String phoneNumber = phone.getText().toString();
|
||||
String userPassword = password.getText().toString();
|
||||
|
||||
if (phoneNumber.isEmpty() || userPassword.isEmpty()) {
|
||||
Toast.makeText(LoginMainActivity.this, "内容不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!radioButton.isChecked()) {
|
||||
Toast.makeText(LoginMainActivity.this, "请同意协议", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
userApi api2 = RetrofitUtils.getRetrofit("https://dev.usemock.com/664ac0559e857b0cdafce629/").create(userApi.class);
|
||||
try {
|
||||
Call<User> call = api2.Login(phoneNumber);
|
||||
call.enqueue(new Callback<User>() {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
User user = response.body();
|
||||
if (user != null && user.password.equals(userPassword)) {
|
||||
Intent intent = new Intent(LoginMainActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
// 登录失败
|
||||
Toast.makeText(LoginMainActivity.this, "Login failed", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
Toast.makeText(LoginMainActivity.this, "Network error", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e("YourTag", "Error occurred: " + e.getMessage()); // 打印异常信息
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
findViewById(R.id.textView174).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(LoginMainActivity.this,EnrollActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.textView175).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(LoginMainActivity.this,ForgetPasswordActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class RetrofitUtils {
|
||||
|
||||
public static Retrofit getRetrofit(String url) {
|
||||
//日志显示级别
|
||||
HttpLoggingInterceptor.Level level= HttpLoggingInterceptor.Level.BODY;
|
||||
//新建log拦截器
|
||||
HttpLoggingInterceptor loggingInterceptor=new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
|
||||
@Override
|
||||
public void log(String message) {
|
||||
//我们采取分段打印日志的方法:当长度超过4000时,我们就来分段截取打印
|
||||
//剩余的字符串长度如果大于4000
|
||||
if (message.length() > 4000) {
|
||||
for (int i = 0; i < message.length(); i += 4000) {
|
||||
//当前截取的长度<总长度则继续截取最大的长度来打印
|
||||
if (i + 4000 < message.length()) {
|
||||
Log.i("RetrofitMessage" + i, message.substring(i, i + 4000));
|
||||
} else {
|
||||
//当前截取的长度已经超过了总长度,则打印出剩下的全部信息
|
||||
Log.i("RetrofitMessage" + i, message.substring(i, message.length()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//直接打印
|
||||
Log.i("RetrofitMessage", "OkHttp====Message:" + message);
|
||||
}
|
||||
}
|
||||
});
|
||||
loggingInterceptor.setLevel(level);
|
||||
//定制OkHttp
|
||||
OkHttpClient.Builder httpClientBuilder = new OkHttpClient
|
||||
.Builder();
|
||||
//OkHttp进行添加拦截器loggingInterceptor
|
||||
httpClientBuilder.addInterceptor(loggingInterceptor);
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(url)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client( httpClientBuilder.build())
|
||||
.build();
|
||||
|
||||
return retrofit;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class User {
|
||||
|
||||
@SerializedName("id")
|
||||
public Integer id;
|
||||
@SerializedName("username")
|
||||
public String username;
|
||||
@SerializedName("phone")
|
||||
public String phone;
|
||||
@SerializedName("password")
|
||||
public String password;
|
||||
@SerializedName("age")
|
||||
public Integer age;
|
||||
@SerializedName("school")
|
||||
public String school;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface userApi {
|
||||
@FormUrlEncoded
|
||||
@POST("userlogin")
|
||||
Call<User> Login (@Field("phone") String phone);
|
||||
@POST("userenroll")
|
||||
Call<User> Enroll (@Field("phone") String phone,@Field("password") String password );
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#C3C3C3" /> <!-- 设置边框的宽度和颜色 -->
|
||||
<padding
|
||||
android:left="8dp"
|
||||
android:right="8dp"
|
||||
android:top="8dp"
|
||||
android:bottom="8dp" /> <!-- 设置文本与边框之间的内边距 -->
|
||||
</shape>
|
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".LoginMainActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView144"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/password1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/password1"
|
||||
app:layout_constraintTop_toTopOf="@+id/password1"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
app:srcCompat="@drawable/img_122" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password2"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="104dp"
|
||||
android:backgroundTint="#D3D3D3"
|
||||
android:ems="10"
|
||||
android:hint="再次确认密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#DCDCDC"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.504"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView141"
|
||||
android:layout_width="148dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/img_117" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/phone"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:backgroundTint="#CAC9C9"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="手机号"
|
||||
android:textColor="#CACACA"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password1"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:backgroundTint="#D3D3D3"
|
||||
android:ems="10"
|
||||
android:hint="密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#DCDCDC"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView170"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="欢迎来到网易云课堂"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView141"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView141"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView142"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/phone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/phone"
|
||||
app:layout_constraintTop_toTopOf="@+id/phone"
|
||||
app:srcCompat="@drawable/img_121" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView145"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/password2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/password2"
|
||||
app:layout_constraintTop_toTopOf="@+id/password2"
|
||||
app:srcCompat="@drawable/img_122" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enter"
|
||||
android:layout_width="230dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:background="#C51228"
|
||||
android:text="修改密码"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/password1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,140 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".LoginMainActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView144"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/password1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/password1"
|
||||
app:layout_constraintTop_toTopOf="@+id/password1"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
app:srcCompat="@drawable/img_122" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password2"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="104dp"
|
||||
android:backgroundTint="#D3D3D3"
|
||||
android:ems="10"
|
||||
android:hint="再次确认密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#DCDCDC"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.504"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView141"
|
||||
android:layout_width="148dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/img_117" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/phone"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:backgroundTint="#CAC9C9"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="手机号"
|
||||
android:textColor="#CACACA"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password1"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:backgroundTint="#D3D3D3"
|
||||
android:ems="10"
|
||||
android:hint="密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#DCDCDC"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView170"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="欢迎来到网易云课堂"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView141"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView141"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView142"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/phone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/phone"
|
||||
app:layout_constraintTop_toTopOf="@+id/phone"
|
||||
app:srcCompat="@drawable/img_121" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView145"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/password2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/password2"
|
||||
app:layout_constraintTop_toTopOf="@+id/password2"
|
||||
app:srcCompat="@drawable/img_122" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enter"
|
||||
android:layout_width="230dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:background="#C51228"
|
||||
android:text="注册"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/password1" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="登录即同意用户协议"
|
||||
android:textColor="#515151"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView174"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="39dp"
|
||||
android:text="已有账号?点击登录"
|
||||
android:textColor="#9C9C9C"
|
||||
app:layout_constraintEnd_toEndOf="@+id/enter"
|
||||
app:layout_constraintStart_toStartOf="@+id/enter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/enter" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".LoginMainActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView144"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/password1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/password1"
|
||||
app:layout_constraintTop_toTopOf="@+id/password1"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
app:srcCompat="@drawable/img_122" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView141"
|
||||
android:layout_width="148dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/img_117" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/phone"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:backgroundTint="#CAC9C9"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="手机号"
|
||||
android:textColor="#CACACA"
|
||||
app:layout_constraintStart_toStartOf="@+id/password1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password1"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:backgroundTint="#D3D3D3"
|
||||
android:ems="10"
|
||||
android:hint="输入验证码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#DCDCDC"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView170"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="欢迎来到网易云课堂"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView141"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView141"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView142"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/phone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/phone"
|
||||
app:layout_constraintTop_toTopOf="@+id/phone"
|
||||
app:srcCompat="@drawable/img_121" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enter"
|
||||
android:layout_width="230dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:background="#C51228"
|
||||
android:text="验证"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/password1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fasong"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/textview_border"
|
||||
android:text="发送验证码"
|
||||
android:textColor="#9C9C9C"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/phone"
|
||||
app:layout_constraintStart_toEndOf="@+id/phone"
|
||||
app:layout_constraintTop_toTopOf="@+id/phone" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -18,21 +18,21 @@
|
|||
app:srcCompat="@drawable/img_117" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText"
|
||||
android:id="@+id/phone"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:backgroundTint="#CAC9C9"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:text="手机号"
|
||||
android:hint="手机号"
|
||||
android:textColor="#CACACA"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView141" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextTextPassword"
|
||||
android:id="@+id/password1"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
|
@ -43,7 +43,7 @@
|
|||
android:textColor="#DCDCDC"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView170"
|
||||
|
@ -61,18 +61,18 @@
|
|||
android:id="@+id/imageView142"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/editTextText"
|
||||
app:layout_constraintEnd_toStartOf="@+id/editTextText"
|
||||
app:layout_constraintTop_toTopOf="@+id/editTextText"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/phone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/phone"
|
||||
app:layout_constraintTop_toTopOf="@+id/phone"
|
||||
app:srcCompat="@drawable/img_121" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView144"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/editTextTextPassword"
|
||||
app:layout_constraintEnd_toStartOf="@+id/editTextTextPassword"
|
||||
app:layout_constraintTop_toTopOf="@+id/editTextTextPassword"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/password1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/password1"
|
||||
app:layout_constraintTop_toTopOf="@+id/password1"
|
||||
app:srcCompat="@drawable/img_122" />
|
||||
|
||||
<TextView
|
||||
|
@ -88,7 +88,7 @@
|
|||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextTextPassword" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/password1" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton"
|
||||
|
@ -96,6 +96,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="登录即同意用户协议"
|
||||
android:textColor="#515151"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
@ -106,6 +107,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="39dp"
|
||||
android:text="没有账号?点击注册"
|
||||
android:textColor="#9C9C9C"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView144"
|
||||
app:layout_constraintTop_toBottomOf="@+id/enter" />
|
||||
|
||||
|
@ -114,6 +116,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="忘记密码"
|
||||
android:textColor="#9C9C9C"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView174"
|
||||
app:layout_constraintEnd_toEndOf="@+id/editTextTextPassword" />
|
||||
app:layout_constraintEnd_toEndOf="@+id/password1" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -715,7 +715,7 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_height="170dp"
|
||||
android:background="@color/white"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
Loading…
Reference in New Issue