【发布时间】:2018-07-27 20:37:23
【问题描述】:
我是 android 的初学者,想知道两者之间有什么区别
tools:context 和 android:name 属性?
1. android:name=".fragments.DataFragment"
2. tools:context=".activities.MainActivity"
完整代码:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment"
android:name=".fragments.DataFragment"
tools:layout="@layout/data_fragment"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.MainActivity"
/>
【问题讨论】:
标签: android android-layout android-layout-editor android-tools-namespace