I have an envelope icon in ActionBar which is the message indicator ... I want to make sure that the number of unread messages is displayed right next to the envelope icon. I installed the envelope icon, but I don’t know how to install some textview next to it in which you can set the corresponding message number ... or maybe there is some ready-made solution for how to do it correctly ...
That's how I set the menu in the code
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } and that's how I wrote an XML file
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> <item android:id="@+id/main" android:icon="@drawable/message" android:title="Menu" app:showAsAction="ifRoom|withText" /> </menu> and this is how it looks
