3 dot/settings in top bar buttons - android

When in some apps, there are those 3 dots in the top right of the app, on the action bar (not the home buttons), which allow for more options. In my app I have on, but I do not know how to make it do a method when it is clicked. Do I use android:onClick="METHOD_NAME ? Or do I need to setup a button variable in my activity class and setup and onClickListener? I have already tried both but I may be doing something wrong.

That three dots are the menu in the action bar. They are always shown on devices without a menu key.
See also the documentation for more details.

Three dots are called Overflow(very aptly named) and to use them you need to use ActionBar which is the top long, horizontal bar showing icons, other buttons along with the Overflow button.
Now in some devices where there is no physical menu button you will always see Overflow button.
Go through Docs and tutorials related to ActionBar but keep one thing in mind that ActionBar is only available for devices with android above HoneyComb. For android devices below 3.0 such as GingerBread or Froyo you will have to use compatibility libraries, so that will be an additional task.
And most notable libraries for this purpose are ActionBarSherlock and AppCompat.

Related

Using Option menu for non-physical buttons devices

I am developing an application that must hide title bar to increase screen spaces and for design issues. on non-physical buttons devices like nexus-4 and for Android > 3.0, I can't switch to use Action bar because the title bar is hidden, and in the same times these devices hasn't physical buttons to use standard menu.
My Question: How can I solve this problem
Thanks
How can I solve this problem
Modify your UI to either:
Add back the action bar, or
Add something else on your screen, such as a button, to display something else on the screen that will serve as your "menu". You can see this approach used by many games.

How do I place the three vertical android dots wherever I want within my app, but will still trigger the menu?

I'm building an android game that doesn't have an action bar. Even though I don't have an action bar, I still want the three vertical dots placed somewhere within my app. I'm not sure if I have to create my own image file that contains the dots, or if there's some way to move the dots in the layout manager in eclipse. Then when these dots are selected I want it to do the vertical drop down menu option like it does in the action bar.
Also I want the dots to disappear in android phones running under android 4.0, so that they can just use the normal menu button. Is this possible? It would be even better if I could get the three dots to trigger the menu in phones below 4.0 but I don't think that's possible so I'd rather just hide it entirely.
Thanks.
I'm not sure if I have to create my own image file that contains the dots
The standard overflow icon should be in your SDK.
or if there's some way to move the dots in the layout manager in eclipse
No.
Then when these dots are selected I want it to do the vertical drop down menu option like it does in the action bar.
You are welcome to implement your own PopupMenu for displaying a menu.
Also I want the dots to disappear in android phones running under android 4.0, so that they can just use the normal menu button
You are welcome to call setVisibility() on whatever you are using for your image whenever the mood strikes you. You will also need to arrange to display your own menu for MENU button presses.
IOW, you will need to roll your own menu system: displaying your trigger, displaying the menu based on the trigger, and doing something on menu choice selections. You are welcome to crib bits of this from the AppCompat action bar in the Android Support package, or perhaps ActionBarSherlock, if you wish.
It would be even better if I could get the three dots to trigger the menu in phones below 4.0
Since you are writing it all yourself, you are welcome to have it do whatever you want.

Android tab layout issue

I'm having a bit of a problem with the Android tab layout. I've been trying to make a screen that holds 4 tabs, and a fragment beneath them, when a user presses each tab the fragment dynamically switches to another activity and the tabs stay static, my problem is that I tried to implement it with tab layout and it's deprecated in since Android 4.0, so I tried it with the action bar tabs but then I have the action bar that I don't want nor need.
I have two questions:
Is it possible to use action bar but to hide the action bar and show only the tabs?
Is there a way to use tab layout on Android 4.0 and higher versions?
1.Yes there is possibility.....you should try http://actionbarsherlock.com/
2.ActionBarSherlock works from sdk 7 to sdk 16
I am not really sure about whether you can achieve it or not but if you want to play around with the ActionBar, this would be one of the best places to start.
Just because it is deprecated, doesn't mean that you can't use tabs in Android 4+. ;)
You surely can use Tabs and TabLayout in Android 4+ and everything works perfectly(though you apparently should not as ActionBar is a must better option).
I have tried it myself because even I prefer the TabLayout more than the ActionBar, and thankfully haven't run into any issues until now!
The only thing you will notice is that Eclipse will draw a yellow line over the deprecated code (which you can obviously ignore or just choose to hide all deprecated warnings).

Creating Android Facebook-like menu on bottom bar

I'm using Galaxy tab and it's got a bar on bottom that appears all the time.
FB app shows a new item there that used as a menu button.
How can I declare my menu to be there like FB?
Thanks!
I guess they are still using the old options menu. You can achieve that effect by setting the target sdk to max 10. I wouldn't recommend that as the menu button hides information and is not the current way to go (I'd use an ActionBar)
You should definately look at the ActionBar. In addition to the tab navigation that is available, you have an option for a split action bar for top and bottom. ActionBar is part of Honeycomb (3.x), but if you want to support older versions, there is the ActionBarSherlock library.

android - show menu button on galaxy nexus

i need to have the menu button shown for some activities on galaxy nexus .
i can't find how to do that, since it hides it by default . i don't wish to create an action bar since it takes more space that i want to use to other things .
when setting the "android:targetSdkVersion" value to lower than 14 , it seems to show the menu button , but otherwise, it hides it .
btw, the activity needs to be full screen , with no title/action bars .
it is very weird that this button is not shown by default for so many places (even the launcher) , and on some places it does exist . such a button is a very basic one for so many android devices . google decided that not only that , but instead , the switching button is more important to be shown and it's shown by default (no idea if it's possible to hide it, but i guess not , since home button no longer does anything when long pressed) .
anyway, please help me . i'm quite new on android 4 .
The Menu button has been deprecated in ICS. Your options are 1) run in legacy mode (targetSdkVersion < 14), 2) use an action bar with or without an overflow menu button, 3) add a menu button somewhere in your app area. 4) not using a menu and just adding its actions directly to your app area.
The menu button is more of a legacy thing on newer Android phones with bigger screens since it's normally best to use the Action Bar (1) to provide the user with the actions that would normally be on the menu. These are called "Action Items" and are a better user experience because they appear directly on the Action Bar rather than requiring the user to tap the menu button.
(1) http://developer.android.com/guide/topics/ui/actionbar.html
targetSdkVersion no longer influence the visibility of the legacy overflow menu button on newer devices and OS, it's dead and buried.

Categories

Resources