2016年4月24日日曜日

名前空間「http://schemas.android.com/apk/res-auto」の出自と意味

今まであまり深くは意味も考えずに、半ば「おまじない」的に使っていたが、ドキュメントがあった。

Added support for custom views with custom attributes in libraries. Layouts using custom attributes must use the namespace URI http://schemas.android.com/apk/res-auto instead of the URI that includes the app package name. This URI is replaced with the app specific one at build time.

まとめ

  • カスタム属性の名前空間URI には「http://schemas.android.com/apk/res-auto」を使わなくてはならない。
  • このURIは、ビルド時に 各アプリのパッケージ名を含む別のURI に置き換えられる。