快速返回列表活动中的视图?活动中 2 个视图中的难度



我正在尝试在活动中使用快速返回列表视图。下面给出的链接使用片段来做。

http://www.androidviews.net/2012/12/quickreturn-listview/

我被困在这里:

View view = inflater.inflate(R.layout.fragment, null);
View mHeader = inflater.inflate(R.layout.header, null);

我找不到其他选择。如何更改上面的代码,以便可以在活动中使用它?

快速返回 列表视图使用不同的视图并将它们拼接在一起。然后在片段中对它们进行处理。在活动的情况下我不能这样做。

要从内部活动获取根视图,请使用:

View rootView = getWindow().getDecorView().findViewById(android.R.id.content)

要从内部活动中获得膨胀,请使用:

LayoutInflater layoutInflater = this.getLayoutInflater();

希望这有帮助,如果没有,请告诉我。

相关内容

最新更新