I\'m trying to create an icon/widget (1 cell x 1 cell) that can be placed on the home screen of android. The widget will look and act exactly like the other standard shortcu
The "correct way to do this" is to make a shortcut, and not try to mimic it with an app widget. This has been pointed out repeatedly by the core Android team (notably Romain Guy) on the [android-developers] discussion list, such as:
Widgets should look like widgets, not like shortcuts. The main reason is that there is absolutely NO guarantee about what a shortcut will look like. Other devices (especially ones with custom system UIs like MOTOBLUR or HTC Sense) might have a different look and feel. Or in the next update of Android we might change the way shortcuts are presented.
To make your item consistent with the system look and feel is not hard by referencing the system attribute android:attr/selectableItemBackground
. For example, if you want to make an ImageView in your widget look "selectable" with proper highlighting etc: just do
<ImageView
...
android:background="?android:attr/selectableItemBackground"
...
/>
There are a lot in android_sdk_path/platforms/android-x
. Happy digging!
EDIT: I found out later that this simple attribute does not live in SDK < v11. So the best way I know now is to download the appwidget template pack and use it.