Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use custom fonts and background image in OptionMenu
    primarykey
    data
    text
    <p>I am creating an option menu in m app.Now what i want is to use my custom font in the text that displayed in option menu and also want to set custom background image.But i dont find any clue for that.The code i have used in cretaing option menu is given below..</p> <p><strong>Xml file</strong></p> <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/settingOpt" android:title="@string/opt_menu_txt1" android:icon="@drawable/icon_settings" /&gt; &lt;item android:id="@+id/reminderOpt" android:title="@string/opt_menu_txt2" android:icon="@drawable/icon_settings" /&gt; &lt;item android:id="@+id/helpOpt" android:title="@string/opt_menu_txt3" android:icon="@drawable/icon_settings" /&gt; &lt;item android:id="@+id/shareOpt" android:title="@string/opt_menu_txt4" android:icon="@drawable/icon_settings" /&gt; </code></pre> <p></p> <p><strong>code in java</strong></p> <pre><code>public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settingOpt: Intent intent = new Intent(this, SettingsForm.class); this.startActivity(intent); break; case R.id.reminderOpt: Intent intentR = new Intent(this, ReminderForm.class); this.startActivity(intentR); break; case R.id.helpOpt: Intent intentH = new Intent(this, HelpForm.class); this.startActivity(intentH); break; case R.id.shareOpt: Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("text/plain"); share.putExtra(Intent.EXTRA_SUBJECT, "Name of the thing to share"); share.putExtra(Intent.EXTRA_TEXT, "www.gmail.com"); startActivity(Intent.createChooser(share, "Share LoveCycle's website link with your friends")); break; default: return super.onOptionsItemSelected(item); } return true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload