Android中的xmlns

来源:互联网 发布:艾美仕怎么样 知乎 编辑:程序博客网 时间:2024/06/02 05:33
在android布局文件中,经常可以看到如下的写法:
xmlns:android="http://schemas.android.com/apk/res/android"
其中,xmlns:android其实是一个命名空间,我们在布局文件中便可以使用android来代替http://schemas.android.com/apk/res/android
我们常用的布局可以改为如下文件:
<pre name="code" class="html"><RelativeLayout xmlns:test="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    test:layout_width="match_parent"   test:layout_height="match_parent"    tools:context="${packageName}.${activityClass}" >    <SeekBar      test:layout_centerInParent="true"       test:layout_width="wrap_content"       test:layout_height="match_parent" /></RelativeLayout>


                                             
0 0
原创粉丝点击