1

What is the listener for click event of overflow icon in action bar?

It is not detected in the onoptions selected so where else it can be detected

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    Log.e("id  ", ""+id);

    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}
4

1 回答 1

1

溢出菜单本身没有 onClick 监听器;仅适用于菜单内的项目。当您单击溢出菜单内的元素时,将调用 onOptionsItemSelected()。

于 2015-03-14T08:13:22.227 回答