Android library project uses declare-styleable — how to compile?

前端 未结 6 797
春和景丽
春和景丽 2020-12-18 21:09

I have a custom preferences control that I have defined a few attributes for in values/attrs.xml. Just to focus the conversation, here is an example of attributes that coul

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 22:09

    Use http://schemas.android.com/apk/res-auto

    I found this solution given casually as a side-note in the AndroidSVG project:

    Aside: Note the special schema URL in the namespace. If you were using a custom View from your own project you would use a URL based on your package name. For example http://schemas.android.com/apk/res/com.example.customview. But since the custom View is in an included library you should use the res-auto short-cut. The real schema URL will be automatically inserted when your app is built.

    (I fixed a typo - missing /res/ subfolder - in the quoted text above)

提交回复
热议问题