07 January 2017

Android: Thực hành tạo Layout Facebook

activity_main.xml
Java Android 2017
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#3B5998">

    <LinearLayout
        android:layout_above="@+id/ln"
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="170dp"
            android:layout_height="wrap_content"
            android:src="@drawable/facebook_logo" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/ln"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerInParent="true"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:orientation="vertical">

        <EditText
            android:id="@+id/txtUsername"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginBottom="15dp"
            android:layout_weight="1"
            android:background="@color/white"
            android:hint="username"
            android:paddingLeft="10dp" />

        <EditText
            android:id="@+id/txtPassword"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginBottom="15dp"
            android:layout_weight="1"
            android:background="@color/white"
            android:hint="password"
            android:inputType="textPassword"
            android:paddingLeft="10dp" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginBottom="15dp"
            android:layout_weight="1"
            android:background="@color/colorPrimaryDark"
            android:text="Login"
            android:textAllCaps="false"
            android:textColor="@color/white"
            android:textSize="19sp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Forgot Password"
            android:textColor="@color/white" />
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:layout_marginBottom="20dp"
        android:text="@string/sung_up"
        android:textColor="#fff" />

</RelativeLayout>

0 nhận xét:

Post a Comment

 

BACK TO TOP

Xuống cuối trang