1

是否可以在 android 中创建一个带有两个可点击区域的按钮?如果有怎么办?谢谢你的帮助。

4

4 回答 4

4

您可以添加两个按钮并使用背景图像并将边距设置为 0,这样它们实际上看起来就像一个按钮。

于 2011-06-20T13:20:08.480 回答
2

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

于 2011-06-20T13:20:01.617 回答
0

第一个回答NO。但是您可以将两个标签组合在一起具有相同的按钮类型视图。将两个标签(或任何其他视图)放入相同的布局中。设置该布局的侦听器。

于 2011-06-20T13:19:41.430 回答
-2

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

例如看这里的代码

<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> 
于 2011-06-20T13:19:54.947 回答