tags:

views:

348

answers:

1

Hi,

Is it possible to change the default shape (i.e rectangular) of the button (normal button as well as imagebutton) to something else maybe like star or a triangle in Android? Any tutorials or sample code would be much appreciated.

+2  A: 

That depends on how you define "shape".

Visually, you change the shape by changing the button background resource. See this previous SO question and answer.

However, I haven't tried this with something non-rectangular, so it is possible that while it will look like a star, the "hot zone" for clicks might still be the original rectangle.

You might look at the implementation of RatingBar in the Android open source code, which uses stars, and see if they do anything unusual.

CommonsWare
Actually I want to have an imagebutton in the shape of a star, which can register clicks as well, being a button.
primalpop