如何在Android中减少浮动editText提示和editText框之间的空间?

如何在Android中减少浮动editText提示和editText框之间的空间?,第1张

概述我有一个带有浮动提示的EditText,但我想知道如何减少浮动提示和EditText框之间的空间. 现在我的UI看起来像http://imgur.com/9hQzzx4,我想减少“标题”浮动提示和EditText框之间的空间. 这是我的xml文件的代码 <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http: 我有一个带有浮动提示的EditText,但我想知道如何减少浮动提示和EditText框之间的空间.

现在我的UI看起来像http://imgur.com/9hQzzx4,我想减少“标题”浮动提示和EditText框之间的空间.

这是我的xml文件的代码

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"              androID:layout_wIDth="match_parent"              androID:layout_height="match_parent"              androID:orIEntation="vertical">    <androID.support.v7.Widget.Toolbar        xmlns:androID="http://schemas.androID.com/apk/res/androID"        xmlns:app="http://schemas.androID.com/apk/res-auto"        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:minHeight="?attr/actionbarSize"        androID:background="?attr/colorPrimary"        app:theme="@style/themeOverlay.AppCompat.Dark.Actionbar"        app:popuptheme="@style/themeOverlay.AppCompat.light" >    </androID.support.v7.Widget.Toolbar>    <androID.support.design.Widget.TextinputLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_margintop="16dp"        androID:layout_marginleft="16dp"        androID:layout_marginRight="16dp">        <EditText                        androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:textSize="40dp"            androID:hint="Title"/>    </androID.support.design.Widget.TextinputLayout>    <androID.support.design.Widget.TextinputLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginleft="16dp"        androID:layout_marginRight="16dp">        <EditText                        androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:textSize="32dp"            androID:hint="Details"/>    </androID.support.design.Widget.TextinputLayout></linearLayout>
解决方法 只需在EditText元素上设置paddingtop属性即可.
<androID.support.design.Widget.TextinputLayout    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content">    <EditText        androID:ID="@+ID/place_name"        androID:inputType="text"        androID:hint="@string/name"        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:paddingtop="0dp"/></androID.support.design.Widget.TextinputLayout>
总结

以上是内存溢出为你收集整理的如何在Android中减少浮动editText提示和editText框之间的空间?全部内容,希望文章能够帮你解决如何在Android中减少浮动editText提示和editText框之间的空间?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1132003.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存