0
在带有片段的项目中使用最新的Android Studio。一切都很好,直到旋转屏幕的一个片段。得到的错误带旋转和片段的Android问题
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xx/com.xxx.xxx.MainActivity}:
android.view.InflateException: Binary XML file line #7: Error inflating class fragment
为主要活动的XML看起来像这样
<FrameLayout
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">
<fragment
android:id="@+id/fragment"
android:name="com.xxx.xxx.MainActivityFragment"
tools:layout="@layout/fragment_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
7号线是从Android Studio中创建项目所提供的片段定义。我已经做了一些搜索,并没有找到充气机在重新创建片段时出现旋转问题的原因。
否则不旋转似乎都工作正常。
您是否有不同的横向布局布局?或者,也许问题出现在'fragment_main'布局中? – Karakuri