0

I have created a sample android application that just displays some text and i can see that the menu bar at the top of the activity contains name of the application but not the icon of the application. The menu is also very thin just containing application name with a small font. Going through various tutorial i found that we have to select a particular menu style while creating the application to have a menu that contains both application name and icon, but my application just contains application name and the menu is very thin. Is it possible to increase the menu height now and add application icon to it dynamically or by making some changes in menu xml file?

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/app_name" android:icon="@drawable/ic_launcher"
android:title="My App" />
</menu>
DPH
  • 261
  • 4
  • 16
  • 1
    Please add your menu xml code – vkm Oct 27 '14 at 09:04
  • added the menu xml code – DPH Oct 27 '14 at 09:29
  • "i can see that the menu bar at the top of the activity contains name of the application but not the icon of the application" you are trying to tell about title bar of application.If its relates to title bar customization you should use custom style – Manju Oct 27 '14 at 10:28
  • could you please guide on how to customize the title bar. I have already created an application and i want to customize it. – DPH Oct 27 '14 at 11:36

2 Answers2

1

If you want to customize the ActionBar, here you are a complete tutorial for it:

How can I implement custom Action Bar with custom buttons in Android?

It's very good an complete for customizing almost everything, so I recommend it to you.

Even tough, I ask you to change your question in order to make more clear the target of it, now you know what you were triying to mean ;)

Community
  • 1
  • 1
Juan Aguilar Guisado
  • 1,687
  • 1
  • 12
  • 21
1
<menu xmlns:tools="schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:context="com.example.sample.getMsgActivity"  
xmlns:yourapp="http://schemas.android.com/apk/res-auto">

<!-- Search, should appear as action button -->
<item android:id="@+id/action_write"
      android:icon="@drawable/ic_action_refresh"
      android:title="@string/action_write"
      yourapp:showAsAction="ifRoom" />

<!-- Settings, should always be in the overflow -->
<item android:id="@+id/action_read"
      android:title="@string/action_read"
      yourapp:showAsAction="never" />

REMEMBER: clean, then build. it should work then.

nothingness
  • 694
  • 3
  • 9
  • 25