无法扩展ListFragment - "调用需要API级别11"

4

我正在尝试扩展ListFragment,但是我一直收到上述错误。我已将android支持库添加到我的项目中。

2个回答

19

你的项目/类可能导入错误。 你可能从API 11(android.app.ListFragment)扩展了ListFragment, 而应该从兼容类( android.support.v4.app.ListFragment )扩展ListFragment。


7
尝试添加

import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接