سؤال

Android studio is insisting that layout_width and layout_height are required within my tag. I'm pretty darn sure they're not from reading here. I'm trying to figure out if this is due to some error on my part or a weird Android Studio quirk.

My layout file:

<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/icon"
android:description="@strings/description"/> 

A snippet of my manifest:

<service android:name="com.handmade.tavern.LiveWallpaper"
    android:label="@string/app_name"
    android:permission="android.permission.BIND_WALLPAPER">
    <intent-filter>
        <action android:name="android.service.wallpaper.WallpaperService"/>
    </intent-filter>
    <meta-data android:name="android.service.wallpaper"
         android:resource="@layout/wallpaper_layout"/>
</service>

Has anyone else experienced this? Can anyone explain my mistake? Thanks,

هل كانت مفيدة؟

المحلول

Ok it seems that Android Studio will only allow tags within the res/xml directory. Simply moving the file fixed the problem. I am not sure if Android Studio is being picky or not. I have seen two references to wallpapers stored in the res/layout folder before but I don't know if they are typos. Further comments welcome.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top