问题
I want my user to input something on the homescreen, but every time I add an Edittext to the widget it breaks. I did a little google searching to find that they apparently are not supported in widgets. There is a Google Search widget with an input field on every android phone though, so I am wondering if there is any way to have one in my widget.
Thanks in advance
EDIT: I noticed that the Google search bar doesn't actually have an input, instead it just opens an activity on touch. But there are still other apps like FriendStream which have input parts of their widgets.
回答1:
FriendStream can do it because it uses the modified Sense homescreens. It also enables scrolling that is only possible on "stock" Android since 3.0 (Honeycomb) and above.
To resume:
Sense: Enables since 1.5 at least (and i think before) input and scroll on any Android version homescreens
Android 3.0: Started supporting some of the Sense features, for example scroll on home screen but still not input
So, you can probably add input via edittext on homescrens (or somethink like it) but ONLY on HTC Sense phones.
I don't think that's a good ideia though, but that's already your choice :-)
回答2:
You cannot use EditText into the Homescreen widget. The Google search widget is merely a drawable (selector drawable - pressed, focused and normal state) which launches an Activity.
回答3:
when tap on homescreen widget start transparent activity with EditText
来源:https://stackoverflow.com/questions/5868367/is-there-any-way-to-put-an-edittext-input-field-into-a-homescreen-widget