0

我以前让这段代码在 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);
}

有任何想法吗?

干杯

4

1 回答 1

4

啊,我忘记了在添加适配器之前必须声明页眉和页脚的简单事实

于 2013-05-03T22:53:34.153 回答