Android development of a login interface learning summary

Code demo:

<?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:orientation=“vertical”

tools:context=".MainActivity">


<RelativeLayout
    android:background="#FFFF00"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.8">

    <LinearLayout
        android:layout_marginLeft="100dp"
        android:layout_marginRight="100dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="150dp">


        <ImageView


            android:layout_width="0dp"
            android:layout_height="100dp"
            android:layout_weight="0.5"
            android:src="@drawable/icon_bic">


        </ImageView>

        <TextView
            android:id="@+id/textView"
            android:layout_width="0dp"
            android:layout_height="110dp"

            android:layout_weight="1"
            android:text="工巢"
            android:textColor="#000000"
            android:textSize="70dp"

            ></TextView>
    </LinearLayout>
</RelativeLayout>


<RelativeLayout
    android:paddingLeft="80dp"
    android:paddingRight="80dp"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">
    <EditText
        android:layout_marginHorizontal="40dp"
        android:layout_marginTop="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入账号"

        android:textColor="@android:color/black"
        />
    <ImageView
        android:layout_marginTop="36dp"
        android:layout_width="30dp"
        android:layout_height="60dp"
        android:src="@drawable/icon_phone">

    </ImageView>
    <ImageView
        android:layout_marginTop="90dp"
        android:layout_width="30dp"
        android:layout_height="60dp"
        android:src="@drawable/icon_email">

    </ImageView>

    <EditText
        android:layout_marginHorizontal="40dp"
        android:layout_marginTop="100dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入验证码"


        android:textColor="@android:color/black" />

    <Button
        android:layout_marginTop="180dp"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="80dp"

        android:text="登录"

        ></Button>




</RelativeLayout>

1: Mainly use LinearLayout layout, learn that you can use RelativeLayout relative layout, first use the relative layout to divide into two parts
2: Add the pictures that need to be used to the resource folder Insert picture description here
3: The first part is to set up the background color, add pictures and textInsert picture description here

4: Add the second part of the picture and text, as well as the login button, this color is not ordinary yellow, it is grabbed by Color Cop)Insert picture description here

operation result
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44941105/article/details/114881799