In my first application there is an activity using a GridView layout and an option menu. One of the menu items is "Multiselect" (the same that you can see in the standard Gallery application when you navigate a gallery). My current problem is that I can't find the standard multiselect icon anywhere. I've tried the following:
Eclipse completion capabilities by typing android.R.drawable. and inspecting the list that eclipse shows to me
searching the android-sdk-linux/platforms/android-X/data/res/drawable-XX
searching https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res
visiting http://androiddrawableexplorer.appspot.com/ and similar websites
Where can I find the multiselect icon?
I can't see the icon you are referring to on my build (Android 4.1.1) but when looking for system drawables I have found them in the SDK under a path like;
C:\Program Files\Android\android-sdk\platforms\android-16\data\res\drawable-<your_screen_res>
The "more" icon for menus is called ic_menu_moreoverflow_<some style>_<some theme>.png. I'm sure the icon you are looking for is there...
Edit
Went away and found the icon by setting up an emulator at 2.1, here it is.
Look similar to ic_menu_mark and btn_check_off but admittedly not quite the same!
Finally I got the icon. After googling a little bit I found that GridView doesn't implement native support of multiple selection items. So the multiselect icon is not a standard Android icon and is not distributed with the SDK. The icon is part of the camera application. You can see it in CyanogenMod repo android_packages_apps_Gallery under /res/drawable-hdpi. The icon filename is ic_menu_multiselect_gallery.png.
Related
I'm new to Android Studio and I am trying to create a note app. However, I can't seem to interact with my action bar at all.
I am using the latest version of Android Studio. I was looking some tutorials of Android Studio, videos of one year ago, and in the videos, the app emulator showed 3 dots (the settings icon) on the top-right corner of the action bar. However, mine doesn't create it. It doesn't create any menu icon. In fact, I do NOT have a menu sub-folder on my RES folder, and my MainActivity.java does NOT have the onCreateOptionsMenu and onOptionsItemSelected methods that should be created by default.
Any way I can fix this? How can I add a simple icon my action bar?
Thank you
You can add these methods manually by clicking CTRL+O (shortcut for override methods) and choose these two methods from the list.
You can also write them from scratch or copy-paste them from somewhere.
EDIT:
Try all the different templates in the New Project menu. Maybe some of them works for you. And good luck. This appears to be some weird bug.
All across the internet and several Stack Overflow pages, there are detailed instructions for the implementation of Floating Action Buttons, but nobody explains where I might be able to acquire the icon myself. Is everyone creating his own action buttons for his UI, or is there a downloadable library somewhere I have yet to discover?
Please link and explain!
Google doesn't provide any code for it, but it should be pretty basic to build yourself.
If you'd prefer to use a library for it, I use this one by shamanland: floating-action-button. You can change the color and icon displayed, and have it auto-hide when the user is scrolling.
There's another popular library by futuresimple here: android-floating-action-button. It includes support for sub-actions with text labels, and two button sizes, but won't give you auto-hiding on scrolling. I think I started with this one and switched to shamanland's, but I don't remember why.
I am creating Floating Action Button and shadow with .xml files as explained here and using icons from icons8.com, it has Android Lollipop specific icons.
This may be silly but I've been looking over an hour for the Up Indicator icon so I can customize it in my image editor tool. Where can I find that icon? It is not in the Android Design Icon Pack, as I just searched in it.
If you have SDK installed on your device, you can find the icon in %SDK-FOLDER%/platforms/android-*/data/res/drawable-*/ic_ab_back_holo_light_am . You can take from there and edit it.
Try this one: http://romannurik.github.io/AndroidAssetStudio/index.html
It has many other icons not only the up button. You can also change the icon color if you want.
My original answer called out that the icon exists in Android by default and that it does not to be manually added.
But this did not address the question as asked.
You should be able to get the icon from the Android libraries themselves, or from Google material design icon back available here (https://material.io/tools/icons/?icon=arrow_back&style=baseline)
I'm using Android Studio (actually on Mac), only using real devices
This is 4.1+ only. All projects created from fresh.
CHECK - I did load support and appcompat, as best as I can understand Gradle. [A]
CHECK - onCreateOptionsMenu, etc, looks good...
CHECK - xml is good to go. (I do totally understand the showAsAction options, and tried them all.) [B] Regarding using text or an icon, I tried all permutations.
So what happens?
When I run it on a device (10+ tested). It simply shows as many action bar items as can fit (say, 5 or so). Rotation etc. works perfectly.
But it just will not show the overflow icon!! WTF?? It simply does not show, anywhere, the missing three or four items.
I have tried all this with both "Blank Activity" and "Fullscreen Activity". No matter WHAT I do, it won't show the ##$# overflow.
It's almost like the icon is just not available in the build or something??
Can any Android friends psychic this problem? It's a really "WTF" moment. Thanks in advance.
My workaround ... https://stackoverflow.com/a/22855136/294884 That works great, but you Android guys would laugh at me doing that.
[A]: (Note that I have two build.gradle files; I did it on the inner one inside app/ . Wouldn't work on the outer one.)
[B]: (Note, a common question seems to be when people don't get the difference between 'always' and 'ifRoom'. TBC that is not my problem at all: my problem is the #$## overflow simply will not appear!!)
BTW for anyone new to Android ...
https://stackoverflow.com/a/16046189/294884
that extended discussion may be very useful.
Press "File" in the top left corner of Android Studio, select "Project Structure...". A Dialog will be opened with a list of modules in the left side.
Select the module of your project, go to the tab "Dependencies", press the green "+" on the right, select "Library Dependencies" in the next Dialog you will be able to add the libraries you want.
If "Support v4" and "AppCompat" are not available you should first install "Android Support Library" and "Google Repository" via the Android SDK Manager.
That will be my best guest. Devices with hardware button don't show the 3-dots menu.
Also if the project is 4.1+ you don't need neither support-v4 nor appcompat-v7. Those might be causing some conflict.
Link to Google explanation on buttons on different devices:
http://developer.android.com/design/patterns/compatibility.html
Regarding using the build.gradle file or the dialog, well, probably yes, but I'm already used to the gradle file and never even look at the dialog, but I'm just old school.
Result!
Found Dirty Hack to force the overflow icon to be visible on devices which have the hardware menu button.
private void getOverflowMenu() {
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if(menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Source:http://www.tagwith.com/question_264107_overflow-menu-not-showed-at-action-bar
I had similar problems showing action bar icons when starting to use Android Studio..
Strange that when I looked at the layout in the design screen it did showed the icons properly but when I tried to run the app both on actual device or on the emulator it showed 3 dots instead.
I do know that even on devices that have HW setting button I still see applications that shows action bar icons and not 3 dots.
Finally the only thing that helped was to do this:
// compile 'com.android.support:appcompat-v7:21.0.0'
I comment this library dependency in the gradle that fixed the problem.
I have the Something like this, when i moved my project to android studio, all action bar items instead if being displayed on the action bar, they only appear as text when pressing the hardware button menu, and when run on nexus, the three dots appear in the corner of the action bar !
i tried things suggested on this page, but had no success in showing the items on the action bar !
Im learning android layouts and Ive noticed a particular button widget in some android apps that I would like to add to my own apps, Im just not entirely sure what its called, In some cases this button widget even will include a dropdown list here are a few examples of what Im talking about.
in the first image you will notice that the checkmark, the camera and the pencil are all sitting inside of the button widget i'm after, and in the youtube app you will notice the thumbs up, thumbs down and more buttons
That's ActionBar. Native support for 3.0+ devices, and some work to do in pre 3.0-devices. You can find example in new api 14 samples(called "ActionBarCompat").
Please see my answer here which gives some good links on how to implement the "dashboard" pattern, and use the "quickaction" bar. I think this should put you on the right path. Also there is a link on how to implement the "action bar."
EDIT: According to Mighter, if you use API 1.6 - 2.3 there should be official Google samples for this now. Please see this.