您的位置:首页 > 其它

关于res-auto

2015-09-18 17:03 246 查看
在使用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>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: