My code as below:-
public boolean onCreateOptionsMenu(Menu menu) {
//getSupportMenuInflater().inflate(R.menu.main, menu);
//return true;
// add this
menu.add(Menu.NONE, R.id.testiv, Menu.NONE, "custom")
.setActionView(R.layout.test)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
FrameLayout parent = (FrameLayout)findViewById(R.id.content_frame);
VersionChecker version;
switch (item.getItemId()) {
case R.id.testiv:
//not call
return super.onOptionsItemSelected(item);
}
I try to call onclick the custom layout icon but fail to go into onOptionsItemSelected.