material-design

How to change Toolbar Navigation and Overflow Menu icons (appcompat v7)?

旧时模样 提交于 2019-12-17 07:09:49
问题 I am having a hard time with v7 Toolbar. What was once a simple task for ActionBar , now seems overly complex. No matter what style I set, I cannot change either navigation icon (which opens a Drawer) or overflow menu icon (which opens a menu). So I have a Toolbar <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android

how to highlight the selected Item of Recycler View?

拈花ヽ惹草 提交于 2019-12-17 06:24:23
问题 I have a Recycler View with the Images loaded from the Internal Storage. I want to Highlight the selected item when clicked. I tried a lot of thing but it was not working. Actually what I need is when I click any item in Recycler View that Item must go in My ArrayList and it should also get highlighted and again when I click or say unselect it must again become normal. Here is my Code: public class Images extends Fragment { private List<ImageHolder> imageList; Cursor imageCursor; RecyclerView

How I can remove the unnecessary top padding of the Navigation view?

浪尽此生 提交于 2019-12-17 06:08:25
问题 There's an unnecessary top padding between the header and the first item shown in this picture. How it can be removed? you can find the source code here: https://github.com/chrisbanes/cheesesquare 回答1: NavigationView seeks to match the material design specs for the navigation drawer which state an 8dp space between content areas. Generally there are no ways to override NavigationView to specifically break the specifications. 回答2: You can override predefined dimensions at your dimens.xml as;

Selected tab's color in Bottom Navigation View

我是研究僧i 提交于 2019-12-17 05:45:12
问题 I'm adding a BottomNavigationView to a project, and I would like to have a different text (and icon tint) color for the selected tab (to achieve greying out non-selected tabs effect). Using a different color with android:state_selected="true" in a color selector resource file doesn't seem to work. I also tried having additional item entries with android:state_focused="true" or android:state_enabled="true" , no effect unfortunately. Also tried setting the state_selected attribute to false

NavigationView menu items with counter on the right

亡梦爱人 提交于 2019-12-17 05:40:20
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas

NavigationView menu items with counter on the right

不问归期 提交于 2019-12-17 05:40:06
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas

Circular reveal transition for new activity

佐手、 提交于 2019-12-17 05:39:27
问题 As per https://developer.android.com/training/material/animations.html The ViewAnimationUtils.createCircularReveal() method enables you to animate a clipping circle to reveal or hide a view. To reveal a previously invisible view using this effect: // previously invisible view View myView = findViewById(R.id.my_view); // get the center for the clipping circle int cx = (myView.getLeft() + myView.getRight()) / 2; int cy = (myView.getTop() + myView.getBottom()) / 2; // get the final radius for

Circular reveal transition for new activity

人盡茶涼 提交于 2019-12-17 05:37:23
问题 As per https://developer.android.com/training/material/animations.html The ViewAnimationUtils.createCircularReveal() method enables you to animate a clipping circle to reveal or hide a view. To reveal a previously invisible view using this effect: // previously invisible view View myView = findViewById(R.id.my_view); // get the center for the clipping circle int cx = (myView.getLeft() + myView.getRight()) / 2; int cy = (myView.getTop() + myView.getBottom()) / 2; // get the final radius for

How to implement the Material-design Elevation for Pre-lollipop

折月煮酒 提交于 2019-12-17 04:46:08
问题 Google has shown some nice ways that elevation effect are shown on Lollipop here. android:elevation="2dp" for buttons, android:stateListAnimator="@anim/button_state_list_animator" How can I mimic the elevation effect on pre-Lollipop versions without 3rd party library? 回答1: You can mimic the elevation on pre-Lollipop with a official method. I achieve same effect using, android:background="@android:drawable/dialog_holo_light_frame" My tested output: reference - https://stackoverflow.com/a

Coloring Buttons in Android with Material Design and AppCompat

孤街浪徒 提交于 2019-12-17 02:24:52
问题 Before the AppCompat update came out today I was able to change the color of buttons in Android L but not on older versions. After including the new AppCompat update I am unable to change the color for either version, when I do try the button just disappears. Does anyone know how to change the button color? The following pictures shows what I want to achieve: The white button is default, the red one is what I want. This is what I was doing previously to change the color of the buttons in the