如何在Android中设置按钮样式 [英] How to set button style in android
本文介绍了如何在Android中设置按钮样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
普通"按钮的外观如下:
Normal button looks like:
现在,请让我知道,我该如何制作一个简单的按钮,使其与附加的图像按钮相同(即按钮角形状是圆形的,并且两个按钮之间也没有间隙)
Now, please let me know, How can i make a simple button same as an attached image button (i.e. button corner shape is round and also there is no gap between two buttons)
推荐答案
9-patch在这里可以正常工作,但是我尝试避免使用它们,因为我很难做到:(
9-patch would work fine here, but I try to avoid them since it's hard for me to do them :(
您可以尝试使用selector
并为每个状态使用形状:
You can try having a selector
and using a shape for each state:
形状如下:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#AAFFFFFF"/>
<corners android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp"/>
</shape>
这篇关于如何在Android中设置按钮样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文