Android 自定义命名空间
声明规则
属性定义
示例
声明规则
一般是在布局文件的头部去声明
xmlns:tools="http://schemas.android.com/tools"
xmlns:hiddenLine = "http://schemas.android.com/apk/res/com.example.hiddenline"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
这样就可以在下面定义的布局文件中直接使用了.
android:layout_width = "match_parent"
android:layout_height = "1dp"
android:layout_marginTop = "20dp"
hiddenLine:textColor = "#f84d4d"/>
其中:textColor 是在自定义view的时候,定义的属性.
这就是简单的实现了自定义命名空间.