EditText Alternatives in a Widget? There has to be a way
Asked Answered
I

2

16

Has anyone ever successfully implemented an EditText in a widget? I realize Android does not support this, however, "Friend Stream" on HTC devices does it... Is this due to an HTC feature? Could I implement this on HTC? Anyone have any crazy creative ideas for implementing a textbox which actually allows typing on a homescreen widget?

ANY possible leads on this would be much appreciated!

Isolated answered 14/12, 2010 at 4:15 Comment(0)
C
16

Most of this can be google-ed, expept for the style of TextViews (you can not use EditText in widget..)

But.. go with the style property.. :)

<TextView
    android:id="@+id/etBlahblah"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:layout_marginTop="4dp"
    android:layout_marginBottom="4dp"
    android:layout_marginLeft="2dp"
    android:layout_marginRight="2dp"
    style="@android:style/Widget.EditText">
</TextView>
Clifton answered 6/10, 2012 at 17:27 Comment(1)
Using this and then adding a clickable ="true" then call an activity that has edit field.Sells
D
15

A way to do this is to make a tap on your widget start a new activity (standard) and to make this activity fully transparent. There are ways to retrieve your widget's position, so that you can position a TextView in your activity on top of your widget. Make a tap outside of your TextView close the activity. I think this is what the Google search widget does, you may want to look at this code.

Deledda answered 14/12, 2010 at 6:23 Comment(3)
Ah cool, thanks. This is interesting. The google widget doesn't seem to try that hard... just moves it to the top of the screen in the new activity it launches.Isolated
Thanks Gilles that seems like an interesting logic. I can put a button inplace of the text box but I cant make it look like a search box. How could I possible do that?Kaph
Use Images or check @Stefan's answerCoinstantaneous

© 2022 - 2024 — McMap. All rights reserved.