ActionbarSherlock: Long-click on action item show a Toast?

眉间皱痕 提交于 2019-12-03 13:56:59

问题


When an action item is long-clicked, a Toast without text is show below the action item. Can I disable the Toast? Thanks you.


回答1:


If you omit a title or specify that the action item should be displayed with text then long-pressing will not toast. Otherwise the toast adds clarification of what each action item represents.




回答2:


Using this answer to get the action bar view: https://stackoverflow.com/a/21125631/555914 I used this to disable the toast:

View actionBar = AppUtils.getActionBarView(getActivity());
        if(actionBar!=null) {
            View item = actionBar.findViewById(id);
            if(item!=null) {
                item.setOnLongClickListener(null);
            }
        }

Although I do not recommend disabling this functionality but sometimes designers want something for esthetic reasons...



来源:https://stackoverflow.com/questions/10946529/actionbarsherlock-long-click-on-action-item-show-a-toast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!