机器人 - 按钮样式机器人、样式、按钮

2023-09-05 05:27:09 作者:北执

普通按钮看起来像:

现在,请让我知道,我怎样才能使一个简单的按钮一样的附加图像按钮(即键角形状是圆的,也有两个按键之间没有缝隙)

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补丁将工作在这里很好,但我会尽量避免他们,因为这对我来说很难做到这些:(

9-patch would work fine here, but I try to avoid them since it's hard for me to do them :(

您可以尝试有一个选择和使用形状为每个状态:

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>