6

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:

enter image description here

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:

enter image description here

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

mins
  • 6,478
  • 12
  • 56
  • 75
hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
  • When you looked at the source code for `StackView`, what did you learn about its implementation and how easily it could be backported? – CommonsWare Sep 05 '12 at 18:08
  • @CommonsWare I did not see it's source code.Please tell me where is it. – hasanghaforian Sep 05 '12 at 18:40
  • https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/StackView.java Based on a cursory analysis, you *might* be able to backport this using NineOldAndroids for the animation portions. Nobody appears to have backported it yet, and note that the backport can only be used in an activity, not a home screen app widget. – CommonsWare Sep 05 '12 at 19:36
  • @CommonsWare so how we can implement app widget that user can turn over it's cards? – hasanghaforian Sep 05 '12 at 19:42
  • It is completely impossible in an app widget prior to API Level 11. – CommonsWare Sep 05 '12 at 19:42
  • @CommonsWare Do you see any snippet code that help me to implement an app widget like second image? – hasanghaforian Sep 05 '12 at 20:04
  • Unless you see that from an app in the Play Store, that is most likely not an app widget, but a feature of that particular home screen. – CommonsWare Sep 05 '12 at 20:12
  • @CommonsWare I recently see `Timescape`.It has a widget with 3D animation.It REQUIRES ANDROID:2.1 Do you believe that `It is completely impossible in an app widget prior to API Level 11`? – hasanghaforian Sep 29 '12 at 16:37
  • Timescape is not an app widget. It is part of Sony's (or Sony Ericsson's) version of Android, mostly seen as a custom home screen. "It has a widget with 3D animation" -- no, the home screen has a 3D animation. "It REQUIRES ANDROID:2.1" -- no, it requires whatever version of Android Sony ships it on for a given device. – CommonsWare Sep 29 '12 at 16:49
  • @CommonsWare Thank you.I asked another question that is in about `APP Widget`,but it did not received any answer.I guess you can answer to it,because your experiences on this topic.My question is here: http://stackoverflow.com/q/18398683/1043882 – hasanghaforian Sep 06 '13 at 08:22

1 Answers1

0

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.

Grishka
  • 2,465
  • 1
  • 20
  • 38