赞
踩
- E/AndroidRuntime: FATAL EXCEPTION: main
- Process: com.example.administrator.medx_media, PID: 4283
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.administrator.medx_media/com.example.administrator.medx_media.MainActivity}: android.view.InflateException: Binary XML file line #16: You must specify a layout in the include tag: <include layout="@layout/layoutID" />
- at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793)
这是一个不熟悉include空间的翻车现场。
- <include
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout="@layout/layout_head"
- android:layout_weight="11"/>
每次编译时都会报错,看了很多文章,才找到正确的答案,那就是
一个控件的基础属性的问题。长记性了。
正确的格式演示是:
- <include
- android:id="@+id/title"
- layout="@layout/include_title"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"></include>
把android:去掉即可 ( layout="@layout/include_title")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。