【发布时间】:2021-12-11 04:56:42
【问题描述】:
我有这个代码
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context=".MainActivity">
<TableRow>
<TextView
android:layout_weight="0.5"
android:text="Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"/>
<EditText
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:layout_marginEnd="25dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_weight="0.5"
android:text="Email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"
/>
<EditText
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:layout_marginEnd="25dp"
/>
</TableRow>
<TableRow>
<Button
android:text="Send"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</TableRow>
它看起来像这样 image1
我需要将此按钮居中并拉伸到其他表格行的大小,即到授权表单的大小。比如下面的截图
我尝试使用android:stretchColumns="1",但它不起作用
【问题讨论】:
标签: android xml android-layout mobile