登录、注册、信息页面初步设计

master
liuyx 2 years ago
parent d8dc4ff2fa
commit d1e7a78559

@ -11,6 +11,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity
android:name=".LoginActivity"
android:exported="true">
@ -19,9 +20,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RegisterActivity"
android:exported="false" />
<activity
android:name=".UserInfoActivity"
android:exported="false" />
</application>
</manifest>

@ -3,6 +3,7 @@ package cc.liuyx.app;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@ -21,5 +22,13 @@ public class LoginActivity extends AppCompatActivity {
startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
}
});
Button btnLogin = findViewById(R.id.btn_login);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(LoginActivity.this, UserInfoActivity.class));
}
});
}
}

@ -1,8 +1,10 @@
package cc.liuyx.app;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
public class RegisterActivity extends AppCompatActivity {
@ -10,5 +12,14 @@ public class RegisterActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ImageView back = findViewById(R.id.register_back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// 对于返回按钮,设置返回上一级页面不需要使用 startActivity因为这样就相当于又创建了一个新的页面使用finish结束当前页面即可
RegisterActivity.this.finish();
}
});
}
}

@ -0,0 +1,14 @@
package cc.liuyx.app;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class UserInfoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_info);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#ffffff" />
<padding
android:bottom="16dp"
android:left="15dp"
android:right="15dp"
android:top="16dp" />
</shape>
</item>
<item android:bottom="10dp">
<shape>
<stroke android:color="#000000"/>
</shape>
</item>
</layer-list>

@ -28,7 +28,7 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:gravity="center"
android:hint="请输入用户名"
android:inputType="textPersonName"
@ -40,7 +40,7 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginBottom="20dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:gravity="center"
android:hint="请输入密码"
android:inputType="textPassword"

@ -10,21 +10,33 @@
android:paddingRight="30dp"
tools:context=".RegisterActivity">
<TextView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="70dp"
android:gravity="center_horizontal"
android:text="设置账户信息"
android:textFontWeight="1000"
android:textSize="22sp" />
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginBottom="30dp">
<ImageView
android:id="@+id/register_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_arrow_left" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="设置账户信息"
android:textFontWeight="1000"
android:textSize="22sp" />
</RelativeLayout>
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:drawableEnd="@drawable/ic_user"
android:hint="来将可留姓名?"
android:inputType="textPersonName"
@ -36,7 +48,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:drawableEnd="@drawable/ic_passwd"
android:ems="10"
android:hint="对对暗号"
@ -49,7 +61,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:drawableEnd="@drawable/ic_passwd"
android:ems="10"
android:hint="重复暗号"
@ -62,7 +74,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:drawableEnd="@drawable/ic_phone"
android:hint="留个联系方式~"
android:inputType="phone"
@ -75,7 +87,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/sharp_input"
android:background="@drawable/shape_input"
android:drawableEnd="@drawable/ic_email"
android:hint="邮箱也留个噻"
android:inputType="textEmailAddress"

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:background="#FAF9FA"
android:orientation="vertical"
tools:context=".UserInfoActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:layout_marginBottom="35dp"
android:gravity="center">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_avatar" />
</LinearLayout>
<LinearLayout
android:id="@+id/user_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/shape_infoitem"
android:gravity="center">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_edit" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:text=" 修改信息"
android:textSize="16sp" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="1"
android:src="@drawable/ic_arrow_right" />
</LinearLayout>
<LinearLayout
android:id="@+id/user_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/shape_infoitem"
android:gravity="center">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_setting" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:text=" 设置"
android:textSize="16sp" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="1"
android:src="@drawable/ic_arrow_right" />
</LinearLayout>
<LinearLayout
android:id="@+id/more"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_infoitem"
android:gravity="center">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_more" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:text=" 更多"
android:textSize="16sp" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="1"
android:src="@drawable/ic_arrow_right" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:text="联系我liuyxcc@gmail.com"
android:textAlignment="center" />
</RelativeLayout>
</LinearLayout>

@ -1,16 +1,6 @@
<resources>
<string name="app_name">Echo25</string>
<string name="app_text">Hello Android!</string>
<string name="title_activity_login">LoginActivity</string>
<string name="prompt_email">Email</string>
<string name="prompt_password">Password</string>
<string name="action_sign_in">Sign in or register</string>
<string name="action_sign_in_short">Sign in</string>
<string name="welcome">"Welcome !"</string>
<string name="invalid_username">Not a valid username</string>
<string name="invalid_password">Password must be >5 characters</string>
<string name="login_failed">"Login failed"</string>
<string name="title_activity_regist">RegistActivity</string>
<string name="app_name">简言</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>

@ -1,8 +1,8 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.MyApplication" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 默认按钮颜色 -->
<item name="colorButtonNormal">#9AD9FD</item>
<item name="fontFamily">serif</item>
</style>
</resources>
Loading…
Cancel
Save