ActionBar不会使用微调器显示标题

时间:2014-01-06 20:18:45

标签: android android-actionbar android-arrayadapter

我的ActionBar标题或活动平铺未显示添加了Spinner下拉列表。什么错误?我做了很多研究,但我没有看到问题

public class MainActivity extends ListActivity implements ActionBar.OnNavigationListener{

private static final int EDITOR_ACT_REQUEST = 504;
private static final int MENU_DELETE_ID = 1002;
private ActionBar actionBar;
private ArrayList<SpinnerNavItem> navSpinner;
private TitleNavigationAdapter adapter;
String curdate;
private int currentNoteId;
private ArgueDataS datasource;
List<ArgueItem> argueList;
public static ArrayAdapter<String> add;
private ArgueItem note;
TextView day;
String datastring;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // Spinner title navigation data
    navSpinner = new ArrayList<SpinnerNavItem>();
    navSpinner.add(new SpinnerNavItem("Argue Time", R.drawable.alarm));
    navSpinner.add(new SpinnerNavItem("Top 10", R.drawable.topten));

    adapter = new TitleNavigationAdapter(getApplicationContext(), navSpinner);

    // assigning the spinner navigation     
    actionBar.setListNavigationCallbacks(adapter, this);

1 个答案:

答案 0 :(得分:0)

你应该改变

actionBar.setDisplayShowTitleEnabled(true);

actionBar.setDisplayShowTitleEnabled(false);