daz*_*ito 13 android android-layout android-xml android-edittext
当我在文本中插入文本时,EditText
文本与其行之间存在异常间隙EditText
.这是我的终端上的一个版画屏幕,你可以看到我正在谈论的这个差距,它标有红色.
我玩弄了文字对齐和引力,但没有成功.
这是XML:
<RelativeLayout 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: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=".MainActivity">
<TableLayout
android:id="@+id/startJourneyLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/startLocationTxtView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_gravity="start"
android:text="@string/startLocation"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<EditText
android:id="@+id/startLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_column="1"
android:gravity = "bottom"
android:hint="Some text"
android:inputType="text"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="2"
android:src="@drawable/my_ic_location"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/endLocationTxtView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_gravity="start"
android:gravity="center"
android:text="@string/endLocation"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<EditText
android:id="@+id/endLocation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="1"
android:inputType="text"/>
</TableRow>
<Button
android:id="@+id/goButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="@string/go"/>
</TableLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
有人可以发现为什么会这样,并解释我如何解决它?
---------------编辑-----------------------
我已将原始问题中发布的XML代码更新为我在应用程序中按照评论中的要求提供的真实XML代码.
第一个版画屏幕(上面的一个,来自真实的设备 - >运行Android 4.4.4 CyanogenMod的Galaxy S4),这里是使用API 19的仿真器的打印屏幕
Kis*_*ela 34
要更改EditText文本和底线之间的差距,您可以使用android:paddingBottom
<EditText
android:id="@+id/nameEditText"
style="@style/DarkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/name"
android:paddingBottom="20dp"/>
Run Code Online (Sandbox Code Playgroud)
根据您的要求替换paddingBottom值.
尝试
android:layout_height="wrap_content"
Run Code Online (Sandbox Code Playgroud)
代替
android:layout_height="match_parent"
在你的 EditText 上。
归档时间: |
|
查看次数: |
18415 次 |
最近记录: |