How can i expand the actionbar like PlayNewsstand application and the image below :
What i am looking for found it here.
For your concern try using this in your manifest file ..
yourapp:showAsAction="ifRoom"
Ex:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item android:id="#+id/action_search"
android:icon="#drawable/ic_action_search"
android:title="#string/action_search"
yourapp:showAsAction="ifRoom" />
...
</menu>
Complete reference :: http://developer.android.com/guide/topics/ui/actionbar.html
Related
When i append tools:showIn="navigation_view" to my code it's not showing. But in video which i watched from Youtube this is working fine. What is the problem? Also I can't add library called
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
<group android:checkableBehavior="single">
<item
android:id="#+id/nav_home"
android:icon="#drawable/ic_main_home"
android:title="#string/home" />
<item
android:id="#+id/nav_timetable"
android:icon="#drawable/ic_subject_timetable"
android:title="#string/timetable" />
<item
android:id="#+id/nav_ogrnot"
android:icon="#drawable/ic_ogrnot"
android:title="#string/ogrnot" />
<item
android:id="#+id/nav_yemek_menu"
android:icon="#drawable/ic_yemek_menu"
android:title="#string/yemek_menu" />
<item
android:id="#+id/nav_homework"
android:icon="#drawable/ic_homework"
android:title="#string/homework" />
</group>
<item android:title="#string/optional">
<menu>
<item
android:id="#+id/nav_to_do_list"
android:icon="#drawable/ic_to_do_list"
android:title="#string/to_do_list" />
<item
android:id="#+id/nav_logout"
android:icon="#drawable/ic_logout"
android:title="#string/logout" />
</menu>
</item>
</menu>
I had the same issue with my code. The first thing I did was to delete my already created menu file (Android resource file) and start the process from the top.
Secondly, after creating the menu resource file, on a new line, after typing (tool:), press alt+enter to add this automatically for you... xmlns:tools="http://schemas.android.com/tools"... Then you can go ahead to type in tools:showIn=".....".
To know if this works, in line of code in tools:showIn, when typing the name in the quotes, just type "na'... if there are other popups or suggestions, then you're good to go.
Hope this helps.
I am trying to an a camera icon to my action bar on android studio, but I can not see any icon. I can see is the "camera" text in my overflow. Below is my me.xml file which is in my menu folder, and also is below is my onCreateOptionsMenu() method
<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/action_logout"
android:title="#string/menu_logout_lable"
android:orderInCategory="100"
app:showAsAction="never"/>
<item android:id="#+id/action_edit_friends"
android:title="#string/menu_edit_friends_label" />
<item
android:id="#+id/action_camera"
android:title="#string/menu_camera_label"
android:icon="#drawable/ic_action_camera"
android:showAsAction="always" />
</menu>
i found out why, in my xml file, on the item for the camera
<item
android:id="#+id/action_camera"
android:title="#string/menu_camera_label"
android:icon="#drawable/ic_action_camera"
android:showAsAction="always"
/>
, i changed
android:showAsAction="always"
to
app:showAsAction="always"
the difference been changing android: to app: .
Thanks
I added share button to my ActionBar, but icon of that button seems not ok.
Default button looks like that:
https://monosnap.com/image/yiBpHo6XcMWKmXD1zwcy2w2gRkFBPN.png
But in my case it looks just like "SHARE" textin actionBar:
https://monosnap.com/image/d8cXbr5XIFtwItoaXAKkTjVBPr5eEa.png
How to change it to default?
Here is my menu xml file for activity:
<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.XXXXXXX.XXXXXXXXXXX.app.SomeActivity" >
<item
android:id="#+id/menu_item_share"
app:showAsAction="always"
android:title="Share"
android:actionProviderClass= "android.widget.ShareActionProvider" />
</menu>
add this
android:icon="#android:drawable/ic_menu_share"
<item
android:id="#+id/menu_item_share"
android:orderInCategory="100"
android:title="Share"
android:icon="#drawable/ic_launcher"
app:showAsAction="always"/>
I've run into this problem for my Android application, I'm trying to create an action bar down at the bottom of my application involving three different menus but I have aadt crashing on me. The error message I have turns up as this and aapt crashes.
<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.example.authport.Auth" >
<item
android:id="#+id/action_settings"
android:orderInCategory="100"
android:title="#string/action_charge"
app:showAsAction="never"/>
<item
android:id="#+id/action_charge"
android:orderInCategory="1"
android:title="#string/action_settings"
app:showAsAction="always"/>
<item
android:id="#+id/action_history"
android:orderInCategory="2"
android:title="#string/action_settings"
app:showAsAction="always"/>
<item
android:id="#+id/action_setup"
android:orderInCategory="3"
android:title="#string/action_settings"
app:showAsAction="always"/>
Now is this a simple fix that I am missing or is there a larger problem that needs to be addressed? Any help would benefit me greatly.
Thank you for your posting...
It's because one of your #string is not defined
I have same return code as yours
I want to create a customized submenu where i can add an "about page" to my application. So my submenu would just be a text view with a bunch of info. Im currently defining my menu in XML. Any help or links would be great, thanks!!!
<?xml version="1.0" encoding="UTF-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/settings_menu"
android:title="Settings" />
<item android:id="#+id/about_menu"
android:title="About">
<menu>
<item android:id="#+id/about_submenu"
android:title="Tip Message" />
</menu>
</item>
<item android:id="#+id/quit_menu"
android:title="Quit" />
</menu>
Also just out of curiosity, how would i define a more complex custom submenu, like one that takes user input from a keyboard.
I think it's easier to make something look like a menu. Try Activity with #android:drawable/menu_submenu_background as a background for example.