赞
踩
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/panda" android:layout_centerHorizontal="true" android:layout_marginTop="40dp"/> <EditText android:id="@+id/phone" android:layout_width="match_parent" android:layout_height="50dp" android:ems="10" android:inputType="phone" android:layout_below="@+id/logo" android:layout_marginTop="30dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:hint="请输入手机号" android:background="@drawable/input_shape" android:paddingLeft="15dp"/> <LinearLayout android:id="@+id/passwordLayout" android:layout_width="match_parent" android:layout_height="50dp" android:layout_below="@+id/phone" android:layout_marginTop="20dp" android:layout_alignLeft="@+id/phone" android:layout_alignRight="@+id/phone" android:background="@drawable/input_shape"> <!-- 宽度设置0dp √ 由于权重设置为1 --> <EditText android:id="@+id/password" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:ems="10" android:inputType="textPassword" android:hint="请输入密码" android:paddingLeft="15dp" android:background="@null"/> <!-- gravity相对于父容器排列 --> <View android:layout_width="1dp" android:layout_height="25dp" android:background="@color/inputColor" android:layout_gravity="center_vertical"></View> <Button android:id="@+id/forgetButton" android:layout_width="wrap_content" android:layout_height="match_parent" android:text="忘记密码" android:textColor="@color/inputColor" android:textSize="16sp" android:background="@null"></Button> </LinearLayout> <Button android:id="@+id/loginButton" android:layout_width="wrap_content" android:layout_height="50dp" android:text="登 录" android:textColor="#FFFFFF" android:layout_below="@+id/passwordLayout" android:layout_marginTop="30dp" android:layout_alignLeft="@+id/passwordLayout" android:layout_alignRight="@+id/passwordLayout" android:background="@drawable/button_shape"/> <Button android:id="@+id/registerButton" android:layout_width="wrap_content" android:layout_height="50dp" android:text="注册账号" android:textColor="@color/colorPrimary" android:background="@null" android:layout_below="@+id/loginButton" android:layout_marginTop="10dp" android:layout_centerHorizontal="true"/> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="@color/inputColor"></stroke>
<corners android:radius="8dp"></corners>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"></corners>
<solid android:color="@color/colorPrimary"></solid>
</shape>
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/phoneLayout" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="40dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:background="@drawable/input_shape"> <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:text="+86" android:textSize="16sp" android:gravity="center_vertical" android:paddingLeft="15dp" android:paddingRight="10dp"/> <View android:layout_width="1dp" android:layout_height="25dp" android:background="@color/inputColor" android:layout_gravity="center_vertical"></View> <EditText android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@null" android:hint="请输入手机号" android:paddingLeft="10dp" android:inputType="phone"></EditText> </LinearLayout> <Button android:id="@+id/nextButton" android:layout_width="0dp" android:layout_height="50dp" android:layout_below="@id/phoneLayout" android:layout_marginTop="30dp" android:layout_alignLeft="@id/phoneLayout" android:layout_alignRight="@id/phoneLayout" android:background="@drawable/button_shape" android:text="下一步" android:textSize="20sp" android:textColor="#FFFFFF"/> </RelativeLayout>
import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class ForgetActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forget); //下一步按钮 findViewById(R.id.nextButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ForgetActivity.this, ComfirmActivity.class); startActivity(intent); } }); } }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/codeLayout" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="30dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:background="@drawable/input_shape"> <EditText android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:inputType="number" android:hint="请输入验证码" android:paddingLeft="10dp" android:background="@null"/> <View android:layout_width="1dp" android:layout_height="25dp" android:background="@color/inputColor" android:layout_gravity="center_vertical"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="获取验证码" android:background="@null" android:textColor="@color/inputColor" android:textSize="16sp"/> </LinearLayout> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="50dp" android:layout_below="@+id/codeLayout" android:layout_marginTop="20dp" android:layout_alignLeft="@+id/codeLayout" android:layout_alignRight="@+id/codeLayout" android:background="@drawable/input_shape" android:hint="请输入新密码(6~20位英文或数字)" android:paddingLeft="10dp"/> <Button android:layout_width="match_parent" android:layout_height="50dp" android:layout_below="@+id/password" android:layout_marginTop="40dp" android:layout_alignLeft="@id/password" android:layout_alignRight="@id/password" android:background="@drawable/button_shape" android:text="确认" android:textSize="20sp" android:textColor="#FFFFFF"/> </RelativeLayout>
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class ComfirmActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comfirm);
}
}
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/phoneLayout" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="40dp" android:background="@drawable/input_shape" android:layout_marginLeft="20dp" android:layout_marginRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+86" android:textSize="16sp" android:paddingLeft="10dp" android:paddingRight="10dp"/> <View android:layout_width="1dp" android:layout_height="25dp" android:background="@color/inputColor" android:layout_gravity="center_vertical"/> <EditText android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:inputType="phone" android:hint="请输入手机号" android:textColor="@color/inputColor" android:paddingLeft="10dp" android:background="@null"/> </LinearLayout> <Button android:id="@+id/registerButton" android:layout_width="match_parent" android:layout_height="50dp" android:layout_below="@id/phoneLayout" android:layout_marginTop="40dp" android:layout_alignLeft="@id/phoneLayout" android:layout_alignRight="@id/phoneLayout" android:text="注册" android:textSize="20sp" android:textColor="#FFFFFF" android:background="@drawable/button_shape"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/registerButton" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:text="同意《使用协议》" android:textSize="16sp" android:textColor="@color/inputColor" android:checked="true"></CheckBox> </RelativeLayout>
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class RegisterActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
}
}
import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //忘记密码 findViewById(R.id.forgetButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, ForgetActivity.class); startActivity(intent); } }); //跳转注册界面 findViewById(R.id.registerButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, RegisterActivity.class); startActivity(intent); } }); //跳转用户中心界面 findViewById(R.id.loginButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, UserInfoActivity.class); startActivity(intent); } }); } }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center_vertical" android:paddingLeft="15dp" android:text="个人主页面背景" android:textColor="#000000" android:textSize="18sp"/> <ImageView android:layout_width="20dp" android:layout_height="match_parent" android:src="@drawable/point" android:layout_marginRight="15dp"/> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/inputColor" android:layout_marginLeft="15dp" android:layout_marginRight="15dp"/> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:text="昵称" android:textSize="18sp" android:textColor="#000000" android:gravity="center_vertical" android:paddingLeft="15dp"/> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="今晚打老虎" android:textSize="18sp" android:gravity="center_vertical|right"/> <ImageView android:layout_width="20dp" android:layout_height="match_parent" android:src="@drawable/point" android:layout_marginRight="15dp"/> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/inputColor" android:layout_marginLeft="15dp" android:layout_marginRight="15dp"/> <!-- <LinearLayout android:layout_width="match_parent" android:layout_height="100dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="头像" android:textSize="20sp" android:textColor="#000000" android:gravity="center_vertical" android:paddingLeft="10dp"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:src="@drawable/panda"/> <ImageView android:layout_width="30dp" android:layout_height="match_parent" android:src="@drawable/point"/> </LinearLayout> --> </LinearLayout>
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class UserInfoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_info);
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。