gpt4 book ai didi

Android:在类 fragment 中膨胀异常

转载 作者:太空狗 更新时间:2023-10-29 12:47:41 25 4
gpt4 key购买 nike

我试图在我的代码中使用 fragment ..在我点击 fragment 并尝试设置屏幕方向后,我收到如下错误,...

Unable to start activity ComponentInfo{com.example.frag/com.example.frag.Activity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment

我的 Xml

<LinearLayout android:id="@+id/linear" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" >
<ListView android:id="@+id/android:list" android:layout_height="wrap_content" android:layout_width="fill_parent"/>
<fragment android:id="@+id/frag" android:layout_height="fill_parent" android:layout_width="fill_parent" class="com.example.frag.MyFragment"/>

最佳答案

我找到了答案。,我忘了扩展 FragmentActivity 而不是 Activity..

它现在可以工作了。

引用: https://stackoverflow.com/a/9168223/1542636

关于Android:在类 fragment 中膨胀异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16271279/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com