可以创建一个有两个可点击区域的按钮吗?

时间:2011-06-20 13:14:53

标签: android button clickable

是否可以在Android中创建一个具有两个可点击区域的按钮?如果是这样的话?谢谢你的帮助。

4 个答案:

答案 0 :(得分:4)

您可以添加两个按钮并使用背景图像并将边距设置为0,这样它们几乎就像一个按钮。

答案 1 :(得分:2)

不,但您可以创建两个看起来像一个按钮的按钮。将两个按钮放在一起。创建一个覆盖两个按钮的位图图像。将图像切成两半。将按钮的背景图像设置为两个位图。

答案 2 :(得分:0)

首先回答NO。 但是你可以把两个标签组合起来有相同的按钮类型视图。将两个标签(或任何其他视图)放入相同的布局中。设置该布局的监听器。

答案 3 :(得分:-2)

您可以使用带有地图部分的图像,每个部分将执行不同的javascript。 图像将充当具有不同目标动作的按钮。

例如,查看代码here

<img src ="planets.gif" width ="145" height ="126" alt="Planets" usemap="#planetmap" />

<map name="planetmap">
<area shape ="rect" coords ="0,0,82,126"
onmouseover="writeText('The Sun and the gas giant planets like Jupiter are by far the largest objects in our Solar System.')"
href ="sun.htm" target ="_blank" alt="Sun" />

<area shape ="circle" coords ="90,58,3"
onmouseover="writeText('The planet Mercury is very difficult to study from the Earth because it is always so close to the Sun.')"
href ="mercur.htm" target ="_blank" alt="Mercury" />

<area shape ="circle" coords ="124,58,8"
onmouseover="writeText('Until the 1960s, Venus was often considered a twin sister to the Earth because Venus is the nearest planet to us, and because the two planets seem to share many characteristics.')"
href ="venus.htm" target ="_blank" alt="Venus" />
</map>