Developing alternative UI for Android. Which way I should go?
I am developing an App for Android, in which I need an UI that requires following:
Redraw at least 10fps
Buttons on screen, but not in rectangular shape
The whole screen (or at least the background, if its too heavy for the system) need to do some 'porter-duff' masking before render, on-the-fly
I curr开发者_运维技巧ently figured out two way to go, both have cons & pros:
Start off from existing View - ViewGroup in the framework. Overriding onDraw to add the masking to it. This is easier to implement, but I am not sure if calling 'invalidate' that often will cause any trouble?
Build an alternative View - ViewGroup structure, and do the rendering in SurfaceView. But then I realize I turn up a structure that looks quite close to the existing one in framework, which I feel doing something almost the same with the framework.
Any suggestion?
(ps. in either way, I am not sure how should I catch the button 'click' event, which is in irregular shape)
The button is easy. Just add a Button view to your layout and use XML to define your own custom image.
android:background="@drawable/my_button_background"
The boundary gets automatically defined as the bounds of the drawable. Simple and easy.
精彩评论