android命名空间

Android的命名空间大体上有三种:

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"

android是系统的,比如各种系统属性TextView的android:text

app是自定义的,可以有两个来源:

一是自定义view,来自attr.xml

<declare-styleable name="xxxxxxx">
    <attr name="name" />
    <attr name="value" />
</declare-styleable>

二是databinding

<variable
    name="xxx"
    type="xxxxxxxx" />

tools命名空间:参考https://www.jianshu.com/p/2912bcba4465

三个作用,1.界面调试,apk不会显示;2.去掉警告提示;3.资源压缩

常见是使用ignore  TargetApi等

备注:有时发现android的系统空间也是res-auto里面的,应该是design包里的,design包里的空间使用和自定义的空间使用方法是一样的

可以参考:https://blog.csdn.net/aqi00/article/details/59108336(控件对比)

扫描二维码关注公众号,回复: 5348004 查看本文章

猜你喜欢

转载自blog.csdn.net/jianpan_zouni/article/details/84648208