gpt4 book ai didi

android - fragment 机器人 :fragment Unable to instantiate fragment

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:51:28 30 4
gpt4 key购买 nike

我有问题:

android.app.Fragment$InstantiationException: Unable to instantiate fragment ${packageName}.${activityClass}$GeneralPreferenceFragment

xml 布局不工作:

<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- These settings headers are only used on tablets. -->

<header
android:fragment="${packageName}.${activityClass}$GeneralPreferenceFragment"
android:title="@string/pref_header_general" />

这虽然有效:

<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- These settings headers are only used on tablets. -->

<header
android:fragment="com.example.b.SettingsActivity$GeneralPreferenceFragment"
android:title="@string/pref_header_general" />

知道为什么吗?谢谢!

示例来自从 Android Eclipse 创建新项目时的 SettingsActivty,它仅在平板电脑大小的 AVD 上中断。

将此添加到 AndroidManifest:

    <intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>)

最佳答案

它不起作用,因为 ${packageName}${activityClass} 应该替换为您的包和 Activity 。

你现在正在做。检查这个example来自文档。

关于android - fragment 机器人 :fragment Unable to instantiate fragment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14381121/

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