1

I am trying to create a search widget for the homescreen but running into a few issues. I found out that you cannot use a EditTextView on a widget, so instead I have created a TextView, however it wont let me enter any text into the TextView.

I have a basic widget in place, and found many guides on how to create a widget, but nothing for a search bar in a widget. Here is my layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:orientation="horizontal" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginLeft="10dp"
        android:src="@drawable/logo_menu" />

    <TextView
        android:id="@+id/etBlahblah"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_gravity="center_vertical"
        android:layout_height="wrap_content"
        android:layout_marginLeft="2dp"
        android:clickable="true"
        android:layout_weight="1" />

</LinearLayout>

Can anyone see anything wrong?

Cheers

James King
  • 2,425
  • 7
  • 30
  • 45
  • Did you see this : http://developer.android.com/guide/topics/search/search-dialog.html At : Using the search widget ?? – Nanis Jan 06 '15 at 09:41
  • I did. Again you are unable to use a SearchView in a homescreen widget. And as for the manifest, it states you need to add this:android:name="android.app.searchable", however for a widget you need to use android.appwidget.provider for the meta-data – James King Jan 06 '15 at 10:35
  • Sorry, I misunderstood your problem. Here is the solution (I guess) http://stackoverflow.com/questions/4435808/edittext-alternatives-in-a-widget-there-has-to-be-a-way – Nanis Jan 06 '15 at 13:32

0 Answers0