Android Home Screen widget not working with EditText

Whenever I add an EditText widget to the layout of my home screen widget (confused as the term widget used twice in Android vocabulary: - /), the "Task loading" error window appears.

Here is the layout I'm trying to make; if you remove the EditText, , this will work ...

 <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <Button android:id="@+id/button_generate" android:layout_width="54px" android:layout_height="54px" android:text="Generate" android:textSize="10sp" android:gravity="center" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/edittext_key"> </Button> <TextView android:id="@+id/textview_hash" android:layout_width="75px" android:layout_height="45px" android:text="Password" android:textSize="11sp" android:gravity="left" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/edittext_key"> </TextView> <EditText android:id="@+id/edittext_data2" android:layout_width="200px" android:layout_height="50px" android:textSize="12sp" android:layout_marginTop="20px" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"> </EditText> </RelativeLayout> 

Now the widget on the main screen of Google Search has EditText, , so it is obviously legal to implement it. Any thoughts on why this is not working?

0
source share
1 answer

Widgets use RemoteViews that only support a certain number of interface elements. EditText is not included. The Android documentation shows which ones are supported.

The Google Search home screen widget actually uses a TextView. ( Source code )

+9
source

Source: https://habr.com/ru/post/952582/


All Articles