我以前让这段代码在 a 中工作没有问题ListActivity
,现在我正在重构使用ListFragment
并且代码编译但我看不到任何按钮(页脚)
代码:
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
log("+ ON ACTIVITY CREATED +");
listView = getListView();
// Retrieve routines ArrayList from JSON
routineList = FitnessApp.routineList;
routineList.add(new Routine("test routine"));
adapter = new GeneralTemplateAdapter(routineList, getActivity().getLayoutInflater());
listView.setAdapter(adapter);
// Creating bottom button as a footer view
Button bAddNew = (Button) getActivity().getLayoutInflater().inflate(R.layout.add_new_button, null);
bAddNew.setText("Add Routine");
listView = getListView(); // Get reference to ListActivities ListView
listView.addFooterView(bAddNew);
}
有任何想法吗?
干杯