【发布时间】:2020-10-21 13:50:08
【问题描述】:
默认的 EditText 背景似乎在左侧放置了 ~ 4dp 的填充。这会导致与其他小部件不对齐。
我做了一个简单的应用程序来演示。截图:
布局:
<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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:background="#00ff00"
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="HINT"
android:text="TEXT"
android:singleLine="true"/>
<TextView
android:background="#00ff00"
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
有没有办法阻止它这样做?
【问题讨论】: