如何使用appcompat-v7替换SherlockListFragmentActivity?

时间:2013-11-23 23:17:11

标签: android actionbarsherlock

我正在用SherlockFragmentActivity

替换android.support.v7.app.ActionBarActivity

但我该怎么办SherlockListFragmentActivity?没有ActionBarListActivity ...

1 个答案:

答案 0 :(得分:0)

所以我做了

public class ActionBarListActivity extends ActionBarActivity {

    private ListView mListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_actionbarlist);
        mListView = (ListView)findViewById(android.R.id.list);
    }

    protected void setListAdapter(ArrayAdapter<String> adapter) {
        mListView.setAdapter(adapter);
    }

}

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>