Is there any way to put an EditText/input field into a homescreen widget?

馋奶兔 提交于 2019-12-05 20:58:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!