如何减少Android布局中文本之间的行距? [英] How do I reduce the line spacing between text in my Android layout?
本文介绍了如何减少Android布局中文本之间的行距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想减小附件布局中文本之间的行距(User12、5部电影,提高了2.5%).
I'd like to decrease the line spacing between the text (User12, 5 movies, 2.5% improved) in the attached layout.
这是下面的xml(我尝试删除了singleLine ="true"语句,并尝试将其设置为false):
Here's the xml below (I tried removing the singleLine="true" statement and tried setting it to false):
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:orientation="horizontal" >
<ImageView
android:id="@+id/icon"
android:src="@drawable/icon"
android:layout_width="36dip"
android:layout_height="36dip"
android:layout_margin="5dip"
android:scaleType="center"
android:layout_gravity="center_vertical" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="7.5">
<TextView
android:id="@+id/scoreDesc"
android:text="User12"
android:layout_marginLeft="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_weight="1"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/scoreDesc"
android:text="5 movies"
android:layout_marginLeft="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_weight="1"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/scoreDesc"
android:text="2.5% improved"
android:layout_marginLeft="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_weight="1"
android:layout_gravity="center_vertical" />
</LinearLayout>
<TextView
android:id="@+id/scoreNum"
android:text="32"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center"
android:textSize="20sp"
android:textStyle="bold"
android:paddingLeft="10dip"
android:paddingRight="60dip"
/>
</LinearLayout>
推荐答案
问了很长时间以来,但是如果将来有人需要答案,只需将负值传递给
Long time since the question was asked but if anyone needs an answer in the future this can be achieved simply by passing a negative value to
android:lineSpacingExtra="-4dp"
这篇关于如何减少Android布局中文本之间的行距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文