Simulate stack view in Android 2 (API 5)?

2019-04-27 06:15发布

问题:

My App must have a widget that can show cards and user can turn over cards. StackWidget sample (in Android's resources) has a good widget:

But there is a StackView in layout of widget and it is available since API Level 11 and I have to implement my App for API level 5.

Also I saw this widget that works API level 7 and upper, and I guess uses OpenGL ES:

Finally how we can simulate stack view in Android 2 (API 5)? Or how we can implement a widget like second image (above)?

回答1:

It is absolutely impossible to use custom views in widgets because of security. You can only use system ones marked with a @RemoteView annotation.

Those fancy animated scrollable 3D widgets OEMs used to put in their firmwares only work with their custom launchers because they are aware of those custom views and allow them to be inflated. Alternatively, these widgets can as well be a part of said custom launchers.