LinearLayout的介紹:
https://blog.csdn.net/YoNow/article/details/117672856
LineraLayout實作微信底部

使用四個LineraLayout來實作(由于圖片大小沒找的太好,所以看起來有點丑)
<?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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="vertical"
android:layout_gravity="bottom">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="45dp">
<ImageView
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@drawable/wechat"
android:layout_weight="1">
</ImageView>
<ImageView
android:layout_width="10dp"
android:layout_height="match_parent"
android:background="@drawable/tel"
android:layout_weight="1">
</ImageView>
<ImageView
android:layout_width="10dp"
android:layout_height="match_parent"
android:background="@drawable/find"
android:layout_weight="1">
</ImageView>
<ImageView
android:layout_width="10dp"
android:layout_height="match_parent"
android:background="@drawable/me"
android:layout_weight="1">
</ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="15dp">
<TextView
android:layout_width="40dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="微信"
android:layout_weight="1">
</TextView>
<TextView
android:layout_width="40dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="通訊錄"
android:layout_weight="1">
</TextView>
<TextView
android:layout_width="40dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="發現"
android:layout_weight="1">
</TextView>
<TextView
android:layout_width="40dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="我"
android:layout_weight="1">
</TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
LineraLayout實作微信UI登錄
<?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:orientation="vertical"
android:layout_height="match_parent"
tools:context=".MainActivity2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="微信號/QQ/郵箱登錄"
android:textColor="#000000"
android:layout_marginLeft="35dp"
android:textSize="28sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="25dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="賬號"
android:textSize="18sp"
android:textColor="#000000"
android:layout_weight="1"
android:layout_marginLeft="25dp">
</TextView>
<EditText
android:layout_marginLeft="35dp"
android:layout_width="300dp"
android:layout_weight="1"
android:hint="請填寫微信號/QQ號/郵箱"
android:layout_height="wrap_content">
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密碼"
android:textSize="18sp"
android:layout_marginLeft="25dp"
android:layout_weight="1"
android:textColor="#000000">
</TextView>
<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:hint="請填寫密碼"
android:layout_weight="1">
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#7D8BA8"
android:text="使用手機號登錄"
android:layout_marginLeft="25dp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登錄">
</Button>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="250dp"
android:layout_gravity="bottom">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="1"
android:text="找回密碼">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:text="緊急凍結">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_weight="1"
android:text="微信安全中心"></TextView>
</LinearLayout>
</LinearLayout>
雖然簡單實作了仿寫微信登錄的功能,但是還是存在一些問題,
不是很方便的移到最底部,只是由于線性布局的局限性導致的,
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/289324.html
標籤:其他
上一篇:day3:UI開發
下一篇:Activity切換效果
