@@ -88,6 +88,42 @@ val poet = ResourcesPoet.create()
8888
8989We do not allow configuration of more complicated resources like ` drawable ` and ` anim ` in the creation sense.
9090
91+ ## Suppressing Lint Warnings
92+
93+ You can add ` tools:ignore ` to suppress Android lint warnings on individual resources or at the top level:
94+
95+ ``` kotlin
96+ // Per-resource ignore
97+ val poet = ResourcesPoet .create()
98+ .addString(" app_name" , " Test" , toolsIgnore = " UnusedResource" )
99+ .addColor(" color_primary" , " #FF0000" , toolsIgnore = " UnusedIds" )
100+ ```
101+
102+ ``` xml
103+ <resources xmlns : tools =" http://schemas.android.com/tools" >
104+ <string name =" app_name" tools : ignore =" UnusedResource" >Test</string >
105+ <color name =" color_primary" tools : ignore =" UnusedIds" >#FF0000</color >
106+ </resources >
107+ ```
108+
109+ You can also set ` tools:ignore ` at the top-level ` <resources> ` element to suppress warnings for all resources in the file:
110+
111+ ``` kotlin
112+ val poet = ResourcesPoet .create()
113+ .toolsIgnore(" UnusedResource,TypographyDashes" )
114+ .addString(" somekey" , " something-else" )
115+ .addString(" anotherkey" , " another-value" )
116+ ```
117+
118+ ``` xml
119+ <resources xmlns : tools =" http://schemas.android.com/tools" tools : ignore =" UnusedResource,TypographyDashes" >
120+ <string name =" somekey" >something-else</string >
121+ <string name =" anotherkey" >another-value</string >
122+ </resources >
123+ ```
124+
125+ Top-level and per-element ignores can be combined — the top-level applies to all children, and per-element ignores override or add to it.
126+
91127License
92128--------
93129
0 commit comments