Explorar el Código

自定义底部导航栏

everywindchase hace 5 meses
padre
commit
91a74a6be6

BIN
app/src/main/res/drawable-hdpi/bg_login.png


+ 14 - 0
app/src/main/res/drawable/login_action_bg.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="oval"
+
+>
+
+
+<solid  android:color="@color/white"/>
+
+
+<stroke android:width="1dp" android:color="@color/white"/>
+
+    <size   android:width="60dp"    android:height="60dp"/>
+</shape>

+ 16 - 0
app/src/main/res/drawable/login_bg.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="rectangle"
+>
+<corners  />
+    <gradient
+        android:angle="35"
+        android:startColor="#46DCB1"
+
+    />
+
+
+
+
+
+</shape>

+ 16 - 0
app/src/main/res/drawable/login_compose_bg.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="rectangle"
+>
+<corners  android:radius="20dp"/>
+    <gradient
+        android:angle="35"
+        android:startColor="@color/white"
+        android:endColor="@color/white"
+    />
+
+
+
+
+
+</shape>

+ 4 - 4
app/src/main/res/drawable/top_bar_bg.xml

@@ -4,10 +4,10 @@
 >
 <corners  android:radius="8dp"/>
     <gradient
-        android:angle="45"
-        android:startColor="#30D3A5"
-        android:centerColor="#3ADD5C"
-        android:endColor="#CEE8C4"
+        android:angle="30"
+        android:startColor="#95E4D4"
+        android:centerColor="#95E4D4"
+        android:endColor="#65EACD"
     />
 
 

+ 23 - 24
app/src/main/res/layout/activity_login.xml

@@ -5,37 +5,40 @@
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:background="#f5f5f5"
+        android:background="@drawable/login_bg"
 >
+
     <androidx.appcompat.widget.LinearLayoutCompat
             android:layout_width="match_parent"
-            android:layout_height="62dp"
+            android:layout_height="100dp"
             android:layout_gravity="center"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
             android:id="@+id/login_top"
-            android:background="@drawable/bg_login"
-    >
+           >
 
 
     </androidx.appcompat.widget.LinearLayoutCompat>
-
     <androidx.appcompat.widget.LinearLayoutCompat
-            android:layout_width="match_parent"
-            android:layout_height="450dp"
+            android:id="@+id/login_compose"
+            android:layout_width="352dp"
+            android:layout_height="360dp"
             android:layout_gravity="center"
             android:gravity="center_horizontal"
             android:orientation="vertical"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@id/login_top"
-            app:layout_constraintHorizontal_bias="0.0">
-
+            android:paddingHorizontal="30dp"
+            android:paddingVertical="20dp"
+            android:background="@drawable/login_compose_bg"
+            android:layout_marginTop="20dp">
         <androidx.appcompat.widget.AppCompatTextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="Login"
+                android:textColor="@color/black"
                 android:textSize="30sp"
                 android:layout_gravity="left"
         />
@@ -44,7 +47,7 @@
         <androidx.appcompat.widget.AppCompatEditText
                 android:layout_width="match_parent"
                 android:layout_height="62dp"
-                android:layout_marginTop="83.5dp"
+                android:layout_marginTop="45dp"
                 android:hint="请输入账号"
                 android:imeOptions="actionNext"
                 android:inputType="text"
@@ -58,7 +61,7 @@
         <androidx.appcompat.widget.AppCompatEditText
                 android:layout_width="match_parent"
                 android:layout_height="62dp"
-                android:layout_marginTop="60.5dp"
+                android:layout_marginTop="48dp"
                 android:hint="请输入账号"
                 android:imeOptions="actionNext"
                 android:inputType="text"
@@ -70,21 +73,17 @@
                 tools:text="密码"/>
 
 
-
-
-        <androidx.appcompat.widget.AppCompatButton
-                android:id="@+id/btn_login"
-                android:layout_width="match_parent"
-                android:layout_height="60dp"
-                android:layout_marginTop="82dp"
-                android:gravity="center"
-                android:text="登录"
-                android:textColor="@color/xui_config_color_red"
-                android:textSize="30sp"
-                android:textStyle="bold"
-                />
     </androidx.appcompat.widget.LinearLayoutCompat>
+    <androidx.appcompat.widget.LinearLayoutCompat
+            android:id="@+id/btn_login"
+            android:layout_width="90dp"
+            android:layout_height="90dp"
+            android:gravity="center_horizontal"
+            android:background="@drawable/login_action_bg"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
 
+            app:layout_constraintTop_toTopOf="@+id/login_compose" android:layout_marginTop="320dp"/>
 
 </androidx.constraintlayout.widget.ConstraintLayout>