问题描述
我 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.
推荐答案
纵观 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!