Android Lint Shape not allowed here

Petar-Krešimir

I have a custom toolbar icon (I needed a toolbar icon with text always visible next to it).

When I inspect my code with Lint, I receive the warning that shape is not allowed here. As much as I understand, I should enclose the shape with item tag, but once I do that the ripple effect is not working on my custom toolbar icon. This is my current code

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?android:colorControlHighlight">
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">

        <padding
            android:bottom="5dp"
            android:left="5dp"
            android:right="5dp"
            android:top="5dp" />

        <corners android:radius="5dp" />

    </shape>
</ripple>

What would be a correct approach to this? I tried moving the shape to a separate drawable file and then referencing it with <item android:drawable:"@drawable/shape"/> and it loads the correct icon and layout, but ripple is gone then.

Petar-Krešimir

Weird, but using just the following for a background of my custom toolbar icon layout does the trick and keeps Lint from complaining.

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?android:colorControlHighlight">
</ripple>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Element ignore is not allowed here, in Android lint.xml

From Dev

Android manifest attribute not allowed here

From Dev

Android: "Element intent-filter is not allowed here" inside <provider>?

From Dev

Element data is not allowed here in Android Studio data binding

From Dev

"AllowOverride not allowed here" in WAMP

From Dev

AllowOverride not allowed here

From Dev

"set" directive is not allowed here

From Dev

.htaccess: LogLevel not allowed here

From Dev

variable declaration not allowed here

From Dev

Array initializer is not allowed here

From Dev

Column not allowed here error

From Dev

"AllowOverride not allowed here" in WAMP

From Dev

variable declaration not allowed here

From Dev

Error: 'void' type not allowed here

From Dev

nginx "env" directive is not allowed here

From Dev

Apache error "AliasMatch not allowed here"

From Dev

cdef statement not allowed here for structure

From Dev

Why is variable declaration not allowed here?

From Dev

NGINX - "server" directive is not allowed here

From Dev

Error: Parse Objects not allowed here

From Dev

Why is lambda function not allowed here?

From Dev

About "group function is not allowed here"

From Dev

Apache error "AliasMatch not allowed here"

From Dev

column not allowed here oracle with getText

From Dev

Error: 'void' type not allowed here

From Dev

@FindBy Annotations not allowed here for CSS

From Dev

Android Studio Lint - set API level for lint

From Dev

Is it possible to include Javac lint in the Android lint report?

From Dev

Kotlin and android lint checks