Linerar Layout Layout Layout Based on Android

Keywords: Mobile Android Attribute xml encoding

With a small goal every day, you will become powerful.

Firstly, we only use the Linerar Layout layout to complete a landing interface. The renderings and blueprints are presented as follows:

 

All layouts and controls are subclasses of landscapes.

Start with the commonly used attributes of the viewfinder class:

attribute

Meaning

Robot: Background

Setting background

Robot: Click

Set up to see if you respond to click events

Robot: Visible

Control View Visibility

Robot: Focusable

Control to see if you can focus on e-magazines

Robot: ID

Setting identifiers for views can be obtained by the findViewById method

Another point is the common attributes in the ViewGroup (which is a subclass of views in the ViewGroup):

attribute

Meaning

Robot: layout_height

Specify the layout height of the subcomponent

Robot: layout_width

Specify the layout width of this subcomponent

 

The detailed code is as follows:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView"
            android:background="#fff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sign in"/>
    </LinearLayout>
    <LinearLayout
        android:background="#fff"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <EditText
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Cell-phone number"/>
        <EditText
            android:id="@+id/password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Password"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <Button
                android:id="@+id/signin"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#fff"
                android:text="register"
                />

            <Button
                android:layout_marginLeft="200dp"
                android:id="@+id/login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Sign in"
                />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

The buttons in the code, TextView's and EditText's are commonly used controls. Just click here. I'll explain them step by step in the following tutorial.

Now that's it. Keep working hard. If you have any questions, please ask them. Struggle for young GO! ...

 

 

 

Posted by Magicman0022 on Fri, 01 Feb 2019 03:09:16 -0800