Search code examples
androidandroid-layoutandroid-viewandroid-xmlandroid-tools-namespace

Android XML Is there a way to use the tool namespace with custom attributes?


I've created a custom view with attributes. Is there a way to use those attributes with android tools in Android studio?

for example :

<MyOwnCoolView
    android:layout_width="96dp"
    android:layout_height="96dp"
    android:padding="3dp"
    tools:dividerAngle="2"/>

Where the attr file is :

<resources>
<declare-styleable name="MyOwnCoolView">
    <attr name="dividerAngle" format="float"/>
</declare-styleable>


Solution

  • My opinion is that you can't.

    There's an official, though very old, page here that quotes:

    Designtime attributes can only be used for framework resources, not custom attributes at this point.