Tag: 膨胀例外

膨胀类碎片android kotlin的错误

所以,首先我回答你的问题:“你真的吗?答案很多。” 是的,我知道,但是我真的试图像第三天那样解决这个问题:在所有的SOF中,我的错误是没有问题的。 我有两个类似的项目:Java和Kotlin。 但是这个f @#^%!@ ing只能在Kotlin中出错。 但XML是身份的100%。 所以,错误是: android.view.InflateException: Binary XML file line #8: Error inflating class fragment 。 我的activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/layoutMain" android:orientation="vertical"> <fragment android:id="@+id/top_fragment" android:name="com.example.weatherapp_kotlin.fragments.TopFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> </fragment> <fragment android:id="@+id/bottom_fragment" android:name = "com.example.weatherapp_kotlin.fragments.BottomFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="4"> </fragment> </LinearLayout> 我试图做的事情: 要将XML中的android:name =""更改为class = "" 在第一个位置设置android:name或class 将LinearLayout更改为RelativeLayout和ConstraintLayout 要改变类extends到FragmentActivity (现在是Fragment和在Java中工作正常) 清理项目 我的LinearLayout有一个id ,一个orientation […]