首页 > 解决方案 > android编辑文本设计-删除编辑文本行底部填充并更改填充之间的文本和行

问题描述

我在android ui设计中遇到了一些问题。

在此处输入图像描述

这是一个编辑文本。我必须删除(1)填充并更改(2)的填充大小。(1) 是下划线和边框之间的填充,(2) 是文本和下划线之间的填充。目前这个editText的 android:includeFontPadding="false" 现在。

请快速回答!

标签: androiduser-interfacematerial-design

解决方案


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"   >

<EditText
    android:id="@+id/etEmail"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="24dp"
    android:background="@null" // removes underline
    android:lines="1"
    app:layout_constraintEnd_toEndOf="parent"        
    />

<View
    android:id="@+id/lineTwo"
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginTop="5dp"  //change this line as you need
    android:background="@android:color/white" 
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/etEmail" />

</android.support.constraint.ConstraintLayout>

推荐阅读