Scenes
Android Layout Manager - Using FrameLayout frame layout manager displays stacked square and the prospects for photos:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103839149
Achieve results as follows
Note:
Blog:
https://blog.csdn.net/badao_liumang_qizhi
public concern number of
programs overbearing ape
acquisition-related programming e-books, tutorials and push for free download.
achieve
The activity_main.xml modified to TableLayout
Then use <TabelRow> tag represents add a line, the first line use
android:paddingTop="200dp">
Set within the top margin
The first line, an empty TextView added, add a horizontally centered and a EditText TextView
<TableRow android:paddingTop="200dp"> <TextView/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="账 号:" android:textSize="18sp" android:gravity="center_horizontal" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="输入邮箱或手机号" /> </TableRow>
第二行,同理,改为密码输入行,不用再设置内顶边距
<TableRow> <TextView/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密 码:" android:textSize="18sp" android:gravity="center_horizontal" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="输入6-16位数字或字母" /> </TableRow>
第三行添加注册和登录按钮
<TableRow> <TextView/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="注 册" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="登 录" android:background="#FF8247" /> </TableRow>
第四行,添加忘记密码提示
<TableRow android:paddingTop="20dp" > <TextView/> <TextView/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FF4500" android:text="忘记密码?" android:gravity="right" /> <TextView/> </TableRow>
完整示例代码
<?xml version="1.0" encoding="utf-8"?> <TableLayout 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=".TableLayoutActivity"> <TableRow android:paddingTop="200dp"> <TextView/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="账 号:" android:textSize="18sp" android:gravity="center_horizontal" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="输入邮箱或手机号" /> </TableRow> <TableRow> <TextView/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密 码:" android:textSize="18sp" android:gravity="center_horizontal" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="输入6-16位数字或字母" /> </TableRow> <TableRow> <TextView/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="注 册" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="登 录" android:background="#FF8247" /> </TableRow> <TableRow android:paddingTop="20dp" > <TextView/> <TextView/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FF4500" android:text="忘记密码?" android:gravity="right" /> <TextView/> </TableRow> </TableLayout>