相关疑难解决方法(0)

如何在EditText中隐藏下划线

如何隐藏EditText下划线(两端带有小衬线的提示行)?

可能有更好的方法来做我想要的:我有一个带有EditText的布局.通常,这显示在用户可以点击它并开始输入或编辑文本的位置.

但是,有时我想使用相同的布局(简化其他逻辑)以只读方式显示相同的数据.我希望演示文稿类似 - 它应该具有相同的高度和相同的字体,但没有下划线.

作为一种权宜之计,我将通过删除EditText并替换TextView来实现这一点.我认为这会产生预期的结果,但这似乎是一种迂回的做法,通过改变属性来做一些应该很容易做到的事情.

android textview android-edittext

444
推荐指数
14
解决办法
28万
查看次数

如何从 TextInputLayout 中删除底部填充

第一张图就是我想要的。第二张图是我实现的。如您所见,TextInputLayout 底部有一个填充,这使得灰色背景溢出编辑文本行。

请不要建议负边距或填充,因为它在较新的 API 中不起作用。

这是我用于第一个文本输入布局的 XML。

<android.support.design.widget.TextInputLayout
    android:id="@+id/fullNameTextLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="32dp"
    android:paddingTop="10dp"
    android:background="#EAEAEA"
    android:hint="Full Name"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <EditText
        android:id="@+id/fullNameEditText"
        style="@style/Regular15Grey1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textCapWords"
        android:paddingLeft="12dp"
        android:paddingRight="12dp"
        android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

图片1 图2

java android kotlin textinputlayout

5
推荐指数
1
解决办法
3049
查看次数