如何获得supportactionbar当我的类扩展ExpandableListActivity [英] How to get supportactionbar when my class extends ExpandableListActivity

查看:245
本文介绍了如何获得supportactionbar当我的类扩展ExpandableListActivity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ExpandableListActivity A类延伸,以显示我的数据explandable列表视图,现在我的应用程序支持旧版本,直到API 7如何添加动作条使用 getSupportActionBar()这一类......请帮我

I have a class which extends ExpandableListActivity to display my data as explandable list view, now my app supporting older version till API 7 how to add ActionBar using getSupportActionBar() to this class...Please help me out

public class Facts extends ExpandableListActivity {


public void onCreate(Bundle savedInstanceState) {

    try{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.facts);

        SimpleExpandableListAdapter expListAdapter =
                new SimpleExpandableListAdapter(
                        this,
                        createGroupList(),              // Creating group List.
                        R.layout.facts_grouprow,                // Group item layout XML.
                        new String[] { "questions" },   // the key of group item.
                        new int[] { R.id.row_name },    // ID of each group item.-Data under the key goes into this TextView.
                        createChildList(),              // childData describes second-level entries.
                        R.layout.facts_childrow,                // Layout for sub-level entries(second level).
                        new String[] {"answers"},       // Keys in childData maps to display.
                        new int[] { R.id.grp_child}     // Data under the keys above go into these TextViews.
                        );
        setListAdapter(expListAdapter);     // setting the adapter in the list

    }catch(Exception e){
        System.out.println("Errrr +++ " + e.getMessage());
    }

}

现在建议我如何去实现它。

now suggest me to how to achieve it.

推荐答案

纵观<一个href=\"https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/app/ExpandableListActivity.java\"相对=nofollow> ExpandableListActivity源$ C ​​$ C ,看起来它很容易在自己的类来复制相同的功能,并将它延伸 ActionBarActivity 作为它的基类。

Looking at the ExpandableListActivity source code, it seems like it would be easy to duplicate the same functionality in your own class and have it extend ActionBarActivity as its base class.

这篇关于如何获得supportactionbar当我的类扩展ExpandableListActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆