Reputation: 261
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>
Upvotes: 0
Views: 639
Reputation: 694
<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.
Upvotes: 1
Reputation: 1701
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 ;)
Upvotes: 1