Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MenuItem refresh = menu.findItem(R.id.refreshservice); if (refresh.getActionView()!=null) { refresh.setActionView(null); } else { refresh.setActionView(R.layout.refreshicon_nonstatic); }
问题是,无论我尝试什么,MenuItem 始终为空。身份证是正确的。
你可能想在你的活动中做这样的事情:
@Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.refreshservice: