【问题标题】:QuickReturn ListView in an activity?difficulty in 2 views in an activityQuickReturn ListView 在一个活动中?困难在一个活动中的 2 个视图中
【发布时间】:2014-01-16 13:45:56
【问题描述】:

我正在尝试在活动中使用 QuickReturn ListView。下面给出的链接使用一个片段来做。

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

我被困在这里:

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

我找不到替代品。如何更改上述代码以便在活动中使用?

快速返回 ListView 用于不同的视图并将它们拼接在一起。然后在片段中对它们进行处理。如果有活动,我不能这样做。

【问题讨论】:

    标签: android listview android-listview android-fragments


    【解决方案1】:

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

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

    要从内部活动中获取充气机,请使用:

    LayoutInflater layoutInflater = this.getLayoutInflater();
    

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-16
    • 2012-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-14
    • 1970-01-01
    相关资源
    最近更新 更多