當從設計圖書館看書小吃吧的源代碼,我發現這個sort of XML layout:什麼是佈局<view/> XML標籤
<view xmlns:android="http://schemas.android.com/apk/res/android"
class="android.support.design.widget.Snackbar$SnackbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
style="@style/Widget.Design.Snackbar" />
我從來沒有見過這種XML只用<view/>
標籤(與較低的V,所以這不是View
類)。
我的第一個猜測是,它的工作方式類似於<fragment/>
標籤,表明它要根據class
屬性創建自定義視圖,但爲什麼用這個符號時,他可以只寫:
<android.support.design.widget.Snackbar.SnackbarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
style="@style/Widget.Design.Snackbar" />
?
非常感謝你
這是否足以讓您理解:http://developer.android.com/guide/topics/ui/custom-components.html#modifying –