我怎样才能减少保证金?
我现在的观点之一是这样的。在大 5 附近,特别是在其上方和下方,有相当大的余量。我怎样才能减少或消除这个余量?
相关的 XML 代码如下所示:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView style="@style/medText" android:id="@+id/whenSee" android:text="@string/whenSee" android:layout_alignParentLeft="true" android:layout_above="@+id/newViewValue" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
<TextView style="@style/numberSelect" android:id="@+id/newViewValue" android:text="9" android:layout_above="@+id/press_text" android:layout_alignParentLeft="true" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
<TextView style="@style/medText" android:id="@+id/press_text" android:layout_above="@+id/button_to_press" android:layout_alignParentLeft="true" android:text="@string/press" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
</RelativeLayout>
样式在这里:
<style name="medText">
<item name="android:textSize">22sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<style name="numberSelect">
<item name="android:textSize">80sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
One of my views looks like this right now. Near the big 5, specifically above and below it, there is considerable margin. How can I reduce or remove this margin?
The related XML code looks like this:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView style="@style/medText" android:id="@+id/whenSee" android:text="@string/whenSee" android:layout_alignParentLeft="true" android:layout_above="@+id/newViewValue" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
<TextView style="@style/numberSelect" android:id="@+id/newViewValue" android:text="9" android:layout_above="@+id/press_text" android:layout_alignParentLeft="true" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
<TextView style="@style/medText" android:id="@+id/press_text" android:layout_above="@+id/button_to_press" android:layout_alignParentLeft="true" android:text="@string/press" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
</RelativeLayout>
Styles are here:
<style name="medText">
<item name="android:textSize">22sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<style name="numberSelect">
<item name="android:textSize">80sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
向大 TextView 添加属性
android:includeFontPadding="false"
,它必须缩小填充。Add attribute
android:includeFontPadding="false"
to big TextView, it must shrinks paddings.我遇到了类似的问题 - 两条线一条在另一条之上 - 两条线相距很远。这是因为文本中留有空格,因此重音字符不会粘在上面行中的“y”等符号上。
解决方案是使用负边距:-5px、-5dp。只需在 TextView 上设置 5 即可,因为这是最多空白的来源。一方面你是安全的,因为只有数字。另一方面,您永远无法知道使用的是什么字体。
您或许也可以使用图像。
I had a similar problem - two lines one above the other - were two far away. It is because of space left in texts so that accented characters would not stick to symbols like 'y' from lines above.
The solution is to use negative margin: -5px, -5dp. Just se it on the TextView with 5, because that's where the most blank comes from. On one side you're safe since there are only numbers. On the other hand you can never know what font is used.
You can probably use images, too.