android - Material Design EditText adds wrong padding -
layout.xml:
<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" tools:context=".mainactivity"> <textview android:text="label text" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <edittext android:text="input tex" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout> produces following picture on pre-lollipop on lollipop device.
how can compensate unnecessary padding of edittext?
add android:paddingleft label textview, don't know value should specify.

theme.appcompat uses @drawable/abc_edit_text_material.xml edittext background. sources see insetdrawable. insetdrawable has own "paddings" - @dimen/abc_control_inset_material. compensate these paddings, add android:paddingleft="@dimen/abc_control_inset_material" label's textview.
<textview android:text="label text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingleft="@dimen/abc_control_inset_material"/> i'm not sure final answer, because it's not documented.
Comments
Post a Comment