gpt4 book ai didi

android - 当我的类扩展 ExpandableListActivity 时如何获得 supportactionbar

转载 作者:行者123 更新时间:2023-11-29 17:52:27 25 4
gpt4 key购买 nike

我有一个扩展 ExpandableListActivity 的类以将我的数据显示为可扩展 ListView ,现在我的应用程序支持旧版本直到 API 7 如何使用 添加 ActionBar getSupportActionBar() 到这个类...请帮助我

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());
}

}

现在建议我如何实现它。

最佳答案

查看 ExpandableListActivity source code , 似乎很容易在您自己的类中复制相同的功能并将其扩展 ActionBarActivity 作为其基类。

关于android - 当我的类扩展 ExpandableListActivity 时如何获得 supportactionbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22007024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com