第二次提交

main
Zeno 9 months ago
parent 19ef1c55d5
commit af71da4100

@ -4,7 +4,9 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../gradle-8.4-bin/gradle-8.4" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>

@ -12,6 +12,13 @@
android:supportsRtl="true"
android:theme="@style/Theme.App1"
tools:targetApi="31">
<activity
android:name=".MainActivity3"
android:exported="false" />
<activity
android:name=".MainActivity2"
android:exported="false" />
<meta-data
android:name="com.google.android.actions"
android:resource="@xml/user_login" />

@ -1,6 +1,9 @@
package com.example.app1;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
@ -13,13 +16,21 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
//获取按钮
Button button = (Button) findViewById(R.id.button);
//按钮进行监听
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//监听按钮,如果点击,就跳转
Intent intent = new Intent();
//前一个MainActivity.this是目前页面后面一个是要跳转的下一个页面
intent.setClass(MainActivity.this,MainActivity2.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,39 @@
package com.example.app1;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class MainActivity2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//这个是获取布局文件的,这里是你下一个页面的布局文件//注意这个是跳转界面的不能设置错,应该是第一个
setContentView(R.layout.user_login);
//获取按钮
Button button = (Button) findViewById(R.id.regist);
//按钮进行监听
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//监听按钮,如果点击,就跳转
Intent intent = new Intent();
//前一个MainActivity.this是目前页面后面一个是要跳转的下一个页面
intent.setClass(MainActivity2.this,MainActivity3.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,20 @@
package com.example.app1;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class MainActivity3 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//这个是获取布局文件的,这里是你下一个页面的布局文件//注意这个是跳转界面的不能设置错,应该是第一个
setContentView(R.layout.user_register);
}
}

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M20,1v3h3v2h-3v3h-2L18,6h-3L15,4h3L18,1h2zM12,13c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM14,3.25L14,7h3v3h2.92c0.05,0.39 0.08,0.79 0.08,1.2 0,3.32 -2.67,7.25 -8,11.8 -5.33,-4.55 -8,-8.48 -8,-11.8C4,6.22 7.8,3 12,3c0.68,0 1.35,0.08 2,0.25z"/>
</vector>

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillAlpha="0.3" android:fillColor="@android:color/white" android:pathData="M9,8m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" android:strokeAlpha="0.3"/>
<path android:fillAlpha="0.3" android:fillColor="@android:color/white" android:pathData="M14.48,16.34C13.29,15.73 11.37,15 9,15c-2.37,0 -4.29,0.73 -5.48,1.34C3.2,16.5 3,16.84 3,17.22V18h12v-0.78C15,16.84 14.8,16.5 14.48,16.34z" android:strokeAlpha="0.3"/>
<path android:fillColor="@android:color/white" android:pathData="M9,12c2.21,0 4,-1.79 4,-4c0,-2.21 -1.79,-4 -4,-4S5,5.79 5,8C5,10.21 6.79,12 9,12zM9,6c1.1,0 2,0.9 2,2c0,1.1 -0.9,2 -2,2S7,9.1 7,8C7,6.9 7.9,6 9,6z"/>
<path android:fillColor="@android:color/white" android:pathData="M20,9l0,-3l-2,0l0,3l-3,0l0,2l3,0l0,3l2,0l0,-3l3,0l0,-2z"/>
<path android:fillColor="@android:color/white" android:pathData="M15.39,14.56C13.71,13.7 11.53,13 9,13c-2.53,0 -4.71,0.7 -6.39,1.56C1.61,15.07 1,16.1 1,17.22V20h16v-2.78C17,16.1 16.39,15.07 15.39,14.56zM15,18H3v-0.78c0,-0.38 0.2,-0.72 0.52,-0.88C4.71,15.73 6.63,15 9,15c2.37,0 4.29,0.73 5.48,1.34C14.8,16.5 15,16.84 15,17.22V18z"/>
</vector>

@ -6,13 +6,23 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@color/pink"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:text="Pink"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.widget.Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/one"
android:layout_centerHorizontal="true"
android:text="点击进入登录界面"
tools:ignore="MissingConstraints,UnknownId"
android:background="@color/pink"/>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity3">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -2,8 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"

@ -0,0 +1,123 @@
<?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="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/baseline_music_note_24"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:textColor="#000000"
android:textStyle="italic"
android:text="AAAA"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="@drawable/baseline_face_24"/>
<EditText
android:layout_width="290dp"
android:layout_height="60dp"
android:id="@+id/reg_username"
android:textAlignment="center"
android:maxLength="10"
android:maxLines="1"
android:hint="用户名10位"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="@drawable/baseline_vpn_key_24"/>
<EditText
android:layout_width="290dp"
android:layout_height="60dp"
android:id="@+id/reg_password"
android:textAlignment="center"
android:maxLength="16"
android:maxLines="1"
android:hint="密码6-16位"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="@drawable/baseline_lock_24"/>
<EditText
android:layout_width="290dp"
android:layout_height="60dp"
android:id="@+id/reg_sure_password"
android:textAlignment="center"
android:maxLength="16"
android:maxLines="1"
android:inputType="textPassword"
android:hint="确认密码"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="@drawable/twotone_person_add_alt_24"/>
<RadioGroup
android:layout_width="270dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/reg_man"
android:layout_width="wrap_content"
android:checked="true"
android:layout_height="wrap_content"
android:text="男"/>
<RadioButton
android:id="@+id/reg_woman"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女"/>
</RadioGroup>
</LinearLayout>
<Button
android:id="@+id/reg_register"
android:layout_width="280dp"
android:layout_height="50dp"
android:layout_marginTop="80dp"
android:textSize="18sp"
android:layout_gravity="center_horizontal"
android:background="@drawable/button_login"
android:textColor="#FFFFFF"
android:text="注册"/>
</LinearLayout>

@ -3,4 +3,5 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="blackgreen">#006400</color>
<color name="pink">#FBBCDC</color>
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="button_login" type="id" />
</resources>
Loading…
Cancel
Save