【发布时间】:2016-04-25 20:36:41
【问题描述】:
我的EditText 小部件似乎在左侧填充,并且它们与上方的文本不对齐。这正常吗?有没有办法让它冲洗?
编辑:由于不清楚,我说的是“Hello world”和“Title”没有在左侧对齐。就像“标题”有额外的填充一样。 “标题”下的行在左侧也有相同的额外空间。
这是我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<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:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.hinttest.MainActivity"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"/>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#000000">
<android.support.v7.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#000000">
<android.support.v7.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
谢谢。
【问题讨论】:
-
你的整个布局有左填充
android:paddingLeft="@dimen/activity_horizontal_margin" -
我说的是“Hello world”和“Title”之间的填充差异
-
TextInputLayout 已内置填充,您必须通过向其添加 paddingLeft 来补偿 Hello World TextView。或者对 TextInputLayout 应用负 marginLeft 以匹配 TextView
-
@ClintDeygoo 我有点想这是怎么回事,有没有办法删除它?有没有办法知道该填充的确切值?
标签: android android-support-library android-design-library