Reputation: 42854
What is happening:
Theme.AppCompat.Light.DarkActionBar
ActionBarActiviy
What i want:
I want to show as individual icons
Menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/icnMenuWalletId"
android:icon="@drawable/wallet"
android:showAsAction="ifRoom"
android:title="WALLET">
</item>
<item
android:id="@+id/icnMenuTwoId"
android:icon="@drawable/notification"
android:showAsAction="ifRoom"
android:title="NOTIFICATIONS">
</item>
</menu>
Styles.xml
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- API 11 theme customizations can go here. -->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<!-- Application theme. -->
<style name="AppThemeSplash" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
Upvotes: 2
Views: 206
Reputation: 869
Try this and make sure you have changed the package name tools:context="com.abc.android.HomeActivityNew"
to your package name,hope it will help
<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="com.abc.android.HomeActivityNew" >
<item
android:id="@+id/icnMenuWalletId"
android:icon="@drawable/wallet"
android:showAsAction="always"
android:title="WALLET">
</item>
<item
android:id="@+id/icnMenuTwoId"
android:icon="@drawable/notification"
android:showAsAction="always"
android:title="NOTIFICATIONS">
</item>
</menu>
Upvotes: 0
Reputation: 1371
You have to edit one line in you menu.xml. just edit the line to both the menu items
android:showAsAction="always"
By using this, android will show the menu item always. We normally use ifRoom if menu item is not mandatory to show on actionbar.
Upvotes: 3
Reputation: 4571
Change
android:showAsAction="ifRoom"
to
android:showAsAction="always"
ifRooom is used to move the items to overflow menu if there is no space for it to accomodate
Upvotes: 2