Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

android - Hiding of the Toast for long press on actionBar item

Is some possible way how to hide the toast after long-press on the ActionBar item? I didn't setup a title for the item but it is still there - empty toast.

<item
    android:id="@+id/ab_main_menu_dots"
    android:icon="@drawable/action_icons_dots"
    android:showAsAction="always">
    <menu>
        <item
            android:id="@+id/ab_main_menu_my_profile"
            android:showAsAction="never"
            android:title="@string/ab_my_profile">
        </item>
        <item
            android:id="@+id/ab_main_menu_settings"
            android:showAsAction="never"
            android:title="@string/menu_settings">
        </item>
        <item
            android:id="@+id/ab_main_menu_help"
            android:showAsAction="never"
            android:title="@string/tv_help_login">
        </item>
        <item
            android:id="@+id/ab_main_menu_about_us"
            android:showAsAction="never"
            android:title="@string/ab_about_us">
        </item>
        <item
            android:id="@+id/ab_main_menu_logout"
            android:showAsAction="never"
            android:title="@string/bt_logout_main">
        </item>
    </menu>
</item>

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The only way to hide the toast is when you set the ActionBar menu item to be displayed with text. android:showAsAction="withText". Otherwise the toast adds clarification of what each action item represents even if there is no title set for menu item.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...