Android - 创建自定义形状按钮的可能方法?

时间:2013-10-19 00:39:05

标签: android button imageview

我想知道如何创建一组按钮,如下图所示。

Figure 1

我知道图像视图只能是矩形或正方形,但在我的情况下,这些图像将是一组可能与图像视图重叠的自定义形状按钮,如下图所示。

Figure 2

在这张图片中,我基本上有9个图像视图,应该包含各自的图像,但请注意每个图像视图显示的一些图像包含来自另一个图像视图的图像的一部分。

我计划在使用选择器之前完成按键效果,如ff:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android" >
        <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ic_1_down"/>
        <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ic_1_down"/>
        <item android:state_focused="true" android:drawable="@drawable/ic_1_up"/>
        <item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/ic_1_up"/>
    </selector>

但据我所知,这仅适用于当前视图,并且不会更改受影响的其他图像视图上的图像。所以在这种情况下,例如,

按钮1(左上角)。这个按钮图像部分连接到imageview 2和imageview 4.所以当按下时让按钮变成白色,我也想在imageview 2和4中的按钮部分变成白色。这是怎么做到的?

感谢任何评论或建议。

1 个答案:

答案 0 :(得分:1)

看看这个:https://github.com/strider2023/Radial-Menu-Widget-Android。这家伙开发了一个非常好的放射状菜单,就像你的一样。