关于res-auto
在使用library自定义属性时,命名空间URI需要使用http://schemas.android.com/apk/res-auto,
在编译时,URI会自动替换为当前app的package名。
下面是使用support lib 的属性的例子
<android.support.v4.widget.DrawerLayout android:id="@+id/dl_main_drawer" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- 你的内容布局--> <include layout="@layout/navigation_content"/> <android.support.design.widget.NavigationView android:id="@+id/nv_main_navigation" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/navigation_header" app:menu="@menu/drawer_view"/> </android.support.v4.widget.DrawerLayout> |