Android home screen widget documentation

2019-01-22 23:58发布

问题:

Do you know any books, articles, examples, screencasts that document how to develop an home screen widget on Android?

I just found these links:

  • widget design guidelines
  • Introducing home screen widgets and the AppWidget framework

I would like to develop a tiny home screen ticker and I'm searching for the proper way to code it.

回答1:

There are plenty of examples if you google for "android widget tutorial". Two I found useful were:

  1. HelloWidget from the TheSmilingBlog. Basic tutorial to display an empty box with two buttons.
  2. Creating a Home Screen Widget from developer.com. A more complicated example where it displays an image selected randomly from its collection, with instructions on how to configure the refresh-time as well as buttons on the widget. EDIT: Turns out the buttons on the widget are actually in the sequel to that tutorial, and can be found here.
  3. (I assume you've also read the official tutorial on the Android Developer website)


回答2:

Here is a nice example:

http://github.com/commonsguy/cw-advandroid/tree/master/AppWidget/

You can read the excelent Mark Murph's 'The Busy Coder's Guide to Android Development' Book