0

我没有在sherlock上工作过我想在一个选项卡上创建一个带有两到三个选项卡的sherclockactionbar界面我想要一个带有子项文本的列表视图,它适用于简单的活动,但它不适用于sherlockfragmentactivity。我想禁用标题栏我已在 android 3.0 及更高版本上成功禁用它,但它仍显示在低于 3.0 的 android 版本上。

public class FragmentListArraySupport extends SherlockFragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(SampleList.THEME); //Used for theme switching in samples
    super.onCreate(savedInstanceState);

    // Create the list fragment and add it as our sole content.
    if (getSupportFragmentManager().findFragmentById(android.R.id.content) == null) {
        ArrayListFragment list = new ArrayListFragment();
        getSupportFragmentManager().beginTransaction().add(android.R.id.content, list).commit();
    }
}

public static class ArrayListFragment extends SherlockListFragment {
  public static final String[] items = ("first","second","third");

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(getActivity(),
                android.R.layout.simple_list_item_1, items));
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        Log.i("FragmentList", "Item clicked: " + id);
    }
}
}
4

0 回答 0