当从设计图书馆看书小吃吧的源代码,我发现这个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 –