한마디로 만들 수 없다.
Android의 HomeScreen에 Widget을 만들려면 AppWidgetProvider를 상속 받아서 써야 한다.
근데 여기서 UI를 XML로 꾸밀 때 RemoteViews 라는 녀석을 사용 하는데, 이 녀석은 Activity에서 setContentView에서 보듯이 XML형태로 된 Layout을 쓰게 됩니다.
근데 여기서 Custom View를 만들어서 쓰려고 시도 했지만 ClassNotFound Exception이 계속 뜨는 것이다..
분명히 있는 class 인데 왜!
그러다 검색을 했더니. 이런 말이 Android-developer google groups에 있다.
아 Exception 메세지에 그런 말이라도 좀 써주지 -_-...http://groups.google.com/group/android-developers/msg/a5247467151f5e3a
It's an intentional limitation. Only views that are implemented by the
framework can be used, and only those that are annotated as safe for
remoting.
I don't know if there is a list provided in the SDK docs, but as of 1.5 the
supported Views are:
AbsoluteLayout
AnalogClock
Button
Chronometer
FrameLayout
ImageButton
ImageView
LinearLayout
ProgressBar
RelativeLayout
TextView
Tom
아 우울하다~
추가로
AppWidgetProvider에서 쓰는 RemoteViews에서는 Animation을 적용할 수단이 존재하지 않는다.-_-
보통 (아직까지 내가 알고 있는) Animation을 구현하는 수단은 3가지 인데, 한가지는 Custom class를 만드는 것, 또 하나는 ImageView에다가 AnimationDrawable 을 등록해서 쓰는 것. 마지막으로 animation Package를 쓰는 것이다.
그런데 custom class는 위의 이유로 못쓰고, findById 같은 method를 쓸 수 없기 때문에, AnimationDrawable을 등록 할 수가 없다. 또한 animation package도 위와 같은 이유로 못썼다.
물론 HomeScreen에 Animation이 아예 못 돌아가는 것은 아니다.
Widget의 update 주기를 짧게 해서 Widget을 업데이트 할 때마다 이미지를 바꿔 주니 frame animation이 만들어 졌다.
그러나 이건 너무 비용이 많이 드는 방법인 것이 문제이다...
이올린에 북마크하기
이올린에 추천하기
댓글을 달아 주세요
다른 해결책은 찾지 못했나요?
2009/07/02 11:44 [ ADDR : EDIT/ DEL : REPLY ]