请看看下面的代码设置文本框宽度,其剩余宽度
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/firstNumber"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
在这里,文本框的大小(宽度)非常小。我试图将其设置为适合剩余的宽度,但正如您所看到的那样,它会失败。我也使用了android:weight=1
。请帮忙,我怎样才能将文本框的宽度设置为剩余宽度?
非常感谢!这有帮助! +1从我:) –