开发者

Possible to create a button with two clickable areas?

Is it possible to create a button in android wi开发者_C百科th two clickable areas? If so how? Thanks for any help.


You could add two buttons and use background images and set margins to 0, so that they practically look like a single button.


No, but you could create two buttons that look like one button. Place the two buttons right next to each other. Create a bitmap image that covers both buttons. Cut the image in half. Set the background image of the buttons to the two bitmaps.


first answer NO. but you can put two label combined have same button type view. put both label (or any other view) into same layout. set the listener for that layout.


You can use an image with map parts and each part will execute a different javascript. The image will act as a button with different target actions.

For example look at the code 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> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜