【发布时间】:2014-12-16 04:23:30
【问题描述】:
在下面的sn-p中,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<fragment class="com.example.android.apis.app.FragmentLayout$TitlesFragment"
android:id="@+id/titles" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent" />
</LinearLayout>
class属性是什么,如果是我们的Fragment类,那为什么在它的名字后面加上FragmentLayout$,为什么没有android或者任何命名空间?
我完全可以看出它是Fragment类的名称,因为TitlesFragment是example I took this code from中的Fragment类,而com.example.android.apis.app告诉我,我们必须给这个属性一个完全限定的名称类,但是FragmentLayout$附加到类名的部分是什么,即TitlesFragment?
我从this developer guide 的示例中获取了这段代码,但是没有对类属性的解释。我也找不到任何相关的here in the reference。如果它是太基本的东西,请原谅我。
【问题讨论】:
标签: android android-layout android-fragments android-xml android-listfragment