I want to make my app in Material Design, but one thing I noticed was that the ContextMenus are themed in Holo, as seen here: .
Is there a way to make the context menu Material Themed?
Maybe this post helps:
Styling the popup menu in Android 5.0
They try to do exactly the opposite there. Note that using the ActionBar and using the right application/activity theme should do the trick.
This however is for the ActionBar context menu. I think the longpress ListView context menu is being phased out. It might be possible to make a custom theme for it though:
Android: Theme ContextMenu item selection
Related
Alright, I am trying to understand what I would lose if I use Toolbar as a self-managed ActionBar and not use setSupportActionBar.
AFAIK, all that ActionBar does is, provide placeholders for logo, navigation and menu items and also let Fragments add/customize the menu items.
The same functionality could be achieved using Toolbar.setLogo(), Toolbar.setNavigationIcon(), Toolbar.setNavigationOnClickListener() and Toolbar.inflateMenu() apis. Of course, directing the menu handling logic to Fragments might be lost but I think that is not that big of deal if the Activity knows which Fragment is on top and changes the menu items accordingly.
I am trying to make sure :
If I can achieve every ActionBar capability just by using Toolbar and MenuItems (and not using setSupportActionBar()).
Is it ok to not have an exhaustive knowledge of ActionBar apis. Some of the ActionBar apis are very confusing. Using setHomeAsUp api to show hamburger icon, back icon etc., doesn't feel right. If someone starts learning android today, do they even need to understand the framework's ActionBar apis?
Update : In the article Android Design Support Library under section CoordinatorLayout and the app bar, I learnt that the new paradigm app bar is a replacement for the action bar paradigm. I think action bar will soon be deprecated and we should get used to the new app bar paradigm which covers the new material design user experiences.
Yes you can use achieve similar capabilities of ActionBar in Toolbar.
Mainly the difference lies is Toolbar becomes part of View so we can much more fun playing with them to get Scrolling Techniques
You can use Toolbar separately as View & perform ActionBar alike functionalities. For example, in one of my app I use 2 Toolbar one which is set to setSupportActionBar() while other is just used for some other functionalities.
Conclusion: Well it depends upon your requirements if you want to use Toolbar as self or framework. None the less you can use it as both.
I hope this answers your question well.
To me you are right.
From AppCompatDelegate source code, method setSupportActionBar(),
When set to a non-null value the getSupportActionBar() method will return
an ActionBar object that can be used to control the given toolbar as if it were
a traditional window decor action bar. The toolbar's menu will be populated with the
Activity's options menu and the navigation button will be wired through the standard
android.R.id.home menu select action.
So these are most, if not all, the benefits you will have. As you said, it is easy to implement navigation and menu inflating through Toolbar APIs. However, I don't see what you would gain by not calling setSupportActionBar().
YES YES YES
using setSupportToolBar() is the same old Actionbar the only reason ToolBar is ToolBar is for versatility,same as Fragments is to Views, all lies on how you implement stuff, and also the old Actionbar is kinda boring and much restricted as to Toolbar
Ohoy. As Im upgrading my app to L, I replaced ActionBars with Toolbars and whenever I start an ActionMode now it pushes down all the content. (I suppose this is because the ActionBar is once again shown in order to display the ActionMode.) Is it possible to display the ActionMode as an overlay, or have it reside within the Toolbar?
Also no styling options seem to apply to it, which makes me wonder whether theres a new way to style it. Any ideas?
Im using AppCompat V7 21 and so far Ive tried windowActionModeOverlay=true and toolbar.startActionMode(..)
Use <item name="windowActionModeOverlay">true</item> in your app theme (without android:).
Does anybody know if you can use both NavigationDrawer (slideMenu, such as FourSquare) and DropDown Menu? I'm using ActionBar Sherlock, since I have to support versions from Android 2.3.
First one, NavigationDrawer is to navigate among activities. About DropDown Menu, I want to use it to change the content of some lists.
Thanks in advance.
Yes, you can. The NavigationDrawer and DropDown menu work independently of each other.
For the navigation drawer, you have to make your layouts use the drawerlayout and implement ActionBarDrawerToggle class. For the dropdown menu, you just have to add the dropdowns to your actionbar.
What you want is to change is parent of your app's theme to whatever it is plus .ForceOverflow. For example,
<style name="MyTheme" parent="#style/Theme.Sherlock.ForceOverflow">
Unfortunately, in the newer versions of ABS, the ForceOverflow option has been removed, so in order to use this option, you will have to download an ActionBarSherlock version <= 4.1.0.
I styled my action bar with Android Action Bar Style Generator, so when i press an action drop down item, the background color changes to a custom color instead of the default. Now i want to implement this behavior in the old options menu, too. I tried everything from this answer collection, unfortunately none of them worked. How can i achieve this on the options menu? Note that i'm using ActionbarSherlock and HoloEverywhere, but i think this does not matter here, because these uses the native implementation for the options menu.
I partially solved the issue.
I generated a theme for List Selector with the Android Holo Colors Generator.
I applied the theme. The option menu style also changed on API 11+, because it uses List Selector to theme the options menu dropdown list.
I still cannot properly style the options menu on API 10 and below, but at least my application theme is consistent from API 11.
I noticed some context menus in various tutorials on the web look different than mine, i.e. there a title with an arrow in a circle at the top. Mine is just a square box with items. Is this just a newer version of the context menu, or is there a way to style the menu?
I'd like to center the items, set a backcolor, etc.
ContextMenu has several methods like setHeaderTitle()(for adding a title, but you have setHeaderView() for more complex stuff) so you can customize the ContextMenu in the method onCreateContextMenu().