문제

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