Hello,

I am extending the Android JetPack Navigation Library with new tags. I see 
that the tags and attributes are declared in "values/attr.xml" in the 
navigation-common library. Here is a snippet:

<resources>
    <declare-styleable name="Navigator">
        <attr name="android:id"/>
        <attr name="android:label" />
    </declare-styleable>

    <declare-styleable name="NavGraphNavigator">
        <attr name="startDestination" format="reference" />
        <attr name="accessPolicy" format="enum">
            <enum name="ALL" value="49"/>
            <enum name="PARTNER" value="50"/>
            <enum name="PRIVATE" value="51"/>
        </attr>
    </declare-styleable>

    <declare-styleable name="NavArgument">
        <attr name="android:name" />
        <attr name="android:defaultValue" />
        <attr name="nullable" format="boolean"/>
        <attr name="argType" format="string"/>
        <attr name="src" format="string|reference"/>
    </declare-styleable>

    <declare-styleable name="NavDeepLink">
        <attr name="uri" format="string" />
        <attr name="android:autoVerify" />
    </declare-styleable>

    <declare-styleable name="NavAction">
        <attr name="android:id" />
        <attr name="destination" format="reference" />
        <attr name="launchSingleTop" format="boolean" />
        <attr name="popUpTo" format="reference" />
        <attr name="popUpToInclusive" format="boolean" />
        <attr name="enterAnim" format="reference" />
        <attr name="exitAnim" format="reference" />
        <attr name="popEnterAnim" format="reference" />
        <attr name="popExitAnim" format="reference" />

<!-- added by me>
        <attr name="widgetOn" format="reference" />
        <attr name="gesture" format="enum">
            <enum name="click" value="0"/>
        </attr>
    </declare-styleable>



<!-- added by me>
    <declare-styleable name="NavWidget">
        <attr name="wid" format = "reference"/>
        <attr name="value" format ="string|reference" />
    </declare-styleable>
</resources>


The problem is that when I access a newly added attribute in my app like the 
attribute "gesture" in <action> it works fine. However, if I create a tag 
<widget>, 
I get a Lint warning saying the tag is not recognized. I want to know how to 
create a new tag for a naviagtion graph. I don't want to create a destination 
for which 

I will have to set the @Navigation.name(). But for a new tag that is not a 
destination what do I have to do? I see that <action> works fine and it is 
declared as a style with 

the name "NavAction". Then why doesn't <widget> work? I have declared a 
"NavWidget" style.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/f8c76669-ed30-4724-986a-a824a08b4f54%40googlegroups.com.

Reply via email to