EditText Alternativen in einem Widget? Es muss ein Weg sein
-
09-10-2019 - |
Frage
Hat jemand schon einmal erfolgreich ein EditText in einem Widget implementiert? Ich weiß, Android unterstützt dies nicht, aber „Friend Stream“ auf HTC-Geräten ist es ... Ist dies aufgrund einer HTC-Funktion? Kann ich dies auf HTC implementieren? Wer noch keine verrückten kreative Ideen für eine Textbox Implementierung, die tatsächlich das Schreiben auf einem Homescreen-Widget?
erlaubtANY mögliche Hinweise auf diese wäre sehr willkommen!
Lösung
Die meisten dieser kann gegoogelt werden, mit Ausnahme der Art von Textviews (Sie können nicht EditText verwenden in Widget ..)
Aber .. geht mit der Stil Eigenschaft ..:)
<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>
Andere Tipps
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.