JPM*_*JPM 2 layout android alignment android-edittext
这是我的问题,我有一个登录,并想要排列EditText字段.查看附带的样机图片
.
我尝试了几种方法,无法弄清楚如何制作字段阵容.
我真的讨厌Android中的布局我花了更多的时间只是弄乱了正确排列的东西.希望他们只是废弃它并使用更直观的东西,因为它更像是在HTML中使用表格.所以提前感谢您的帮助和欢呼!
你可以玩RelativeLayout并获得你想要的东西.
这是TableLayout的近似值.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:layout_marginTop="40dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="10dip"
android:text="UserID:" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="USER ID" />
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="10dip"
android:text="Password:" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="PASSWORD" />
</TableRow>
</TableLayout>
<LinearLayout
android:layout_marginTop="50dip"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3"
android:gravity="center">
<Button
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="LOGIN" />
<Button
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="REGISTER" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
6699 次 |
| 最近记录: |