简体   繁体   中英

Remove android:title, for action bar button?

So here's my code for my main.xml , which is in the menu folder.

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Search, should appear as action button -->
<item android:id="@+id/action_new"
      android:icon="@drawable/ic_action_new"
      android:title="@null"
      android:showAsAction="always" />
</menu>

And when I launch my app and hold down on the button, I get a toast, off the button. When I do android:title="@null" , I still get a toast but it's empty. How can I complete get rid of it?

试试这个代码:

getActionBar().setTitle("");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM