删除专用于文本的android Switch中的空格 [英] removing whitespace in android Switch which is devoted to text
本文介绍了删除专用于文本的android Switch中的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
(我们都知道)android开关小部件中有三部分...文本-拇指-轨迹.
我的问题是,如果我们不想使用任何文本,如何才能完全删除此文本部分
因为它破坏了布局的平衡
(we all know) There are three parts in android Switch Widget ... Text - Thumb - Track.
My question is how can we completely remove this text part if we don't want to use any text
because it's ruining the balance of the layout
推荐答案
对开关使用负边距,如下所示,看看它是否有效:
Use negative margin for the switch as follows and see if it works:
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dp" />
我知道有人认为使用负边距是一种不好的做法,但正确的做法似乎是最简单的方法.
I know some people consider it a bad practice to use negative margin but right it seems to be the easiest way.
您也可以根据设备类型以编程方式设置边距.
You can set margin programmatically as well based on device type.
这篇关于删除专用于文本的android Switch中的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文