[英]Android :Button drawable Top
I want to create metro UI, so I did like in the picture But the problem is the position of the icons, they are in the top of the button, and I don't think it's aesthetic interface.我想创建metro UI,所以我在图片中确实喜欢但问题是图标的位置,它们在按钮的顶部,我认为它不是美观的界面。 I inserted the icons in the drawable Top in the button.我在按钮的可绘制顶部中插入了图标。 Well how can make the a little bit in the middle.那么如何才能使中间的一点点。
You have to set the android:paddingTop and android:paddingBottom eqaully.你必须设置 android:paddingTop 和 android:paddingBottom eqaully。 Just don't copy and paste 10dp as the value of the padding.只是不要复制和粘贴 10dp 作为填充的值。 Value depends on the size of your button.值取决于按钮的大小。 Refer to below:参考以下:
<Button
android:id="@+id/find_teacher"
style="@style/page_button"
android:drawableTop="@drawable/ic_search_light"
android:text="@string/find_teacher"
android:paddingTop="10dp"
android:paddingBottom="10dp"/>
This is the output:这是输出:
I can remember 2 options:我记得有 2 个选项:
You might wan't to check the layout documentation您可能不想检查布局文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.