XML : Android widget not rendering, wrong xml in resource?

I have some problem with displaying widget on the emulator. I've created widget_layout.xml:

  <?xml version="1.0" encoding="utf-8"?>  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"      android:orientation="horizontal" android:layout_width="match_parent"      android:layout_height="match_parent">        <ImageView          android:layout_width="wrap_content"          android:layout_height="match_parent"          android:id="@+id/email_button"          android:src="@android:drawable/ic_dialog_email"          />        <ImageView          android:layout_width="wrap_content"          android:layout_height="match_parent"          android:id="@+id/search_button"          android:src="@android:drawable/ic_search_category_default"          />        <ImageView          android:layout_width="wrap_content"          android:layout_height="match_parent"          android:id="@+id/map_button"          android:src="@android:drawable/ic_dialog_map"          />        <ImageView          android:layout_width="wrap_content"          android:layout_height="match_parent"          android:id="@+id/info_button"          android:src="@android:drawable/ic_dialog_info"          />        </LinearLayout>    

Then I've created new resource file widget.xml:

  <?xml version="1.0" encoding="utf-8"?>  <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"      android:minHeight="250dp"      android:minWidth="40dp"      android:previewImage="@drawable/widget_preview"      android:initialLayout="@layout/widget_layout"      android:resizeMode="horizontal|vertical"      android:widgetCategory="home_screen">  </appwidget-provider>    

And of course, I've added to manifest (after </activity> and before </application>):

  <receiver android:name=".AppWidget">              <intent-filter>                  <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>              </intent-filter>              <meta-data android:name="android.appwidget.provider"                  android:resource="//HERE MY widget.xml is not seen"/>          </receiver>    

And first of all, I don't know why, my xml/widget is not recognized by Android Studio as it's shown below:

Not seen xml/widget

And here's the structure of my project:

Structure of the project

I believe it's the reason, why the widget is not shown after I run the emulator. What's wrong with my code?

No comments:

Post a Comment