在xml布局文件中,为什么需要这行代码?
xmlns:android="http://schemas.android.com/apk/res/android"
在xml布局文件中,为什么需要这行代码?
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:是 XML 命名空间,而URL:"http://schemas.android.com/apk/res/android" 意味着
XSD 是 [XML schema definition],用于定义 XML 文件的规则。
例如:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:hint="User Name"
/>
</LinearLayout>
这是一个XML命名空间声明,用于指定在其内部声明的视图组中的属性与Android相关。