My view consists of a RecyclerView with CardView rows. The ripple effect when clicking on it, is only working when I use the Theme.Material.Light as AppTheme.
As soon as I switch to the dark version (Theme.Material) its not working anymore.
Any ideas whats the problem here? Thanks
Stupid me. The ripple effect for the dark themes is white, of course. Therefore I was not seeing it on the white CardView.
Related
Like the picture, I set a dark green color, but the light green background appears.
This is the only thing I've set up.
Button's background was set to the colorPrimary of the theme.
So when I changed Button to Image Button, it came out right.
As a result of the test, it seems that the problem is occurring in material design 1.2.1 or higher.
I have to use Theme.MaterialComponents.Light.NoActionBar, so I can't change Theme.
This is a known issue in material design, and found solution adding app:backgroundTint.
The primary color of my application is white and hence my navigation bar color is also white. My problem is that navigation bar buttons are also white in color. How do I make sure that buttons are visible in white background. The app theme I have used is Theme.AppCompat.Light.DarkActionBar.
I have tried using different theme but none seem to be working so far.
Can anyone tell me how I could resolve this issue?
For Android Oreo and above you can try this:
View.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
For this to take effect, the window must request FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS but not FLAG_TRANSLUCENT_NAVIGATION.
You can also refer here for more details: https://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
Also there is another approach:
you can achieve it by placing this in your theme:
<item name="android:windowLightNavigationBar">true</item>
I have an application with a navigation drawer in it. The layout of the drawer has a specific background color, but the items in it need to have another color. So i added an adapter to fill the list items into the navigationdrawer with another background, what works like a charm. Next I wanted to add a ripple effect to the list items if they get clicked. I read that it's possible to use the following lines to add a ripple effect and a background color.
android:background="#color/navigation_drawer_main_bg"
android:foreground="?attr/selectableItemBackground"
This works fine on my test device with Android 7.1.2 (background is right and ripple effect is there, yay), but on my devixe with Android 5.1.1 there is no ripple effect. Does anyone know a fast solution how the get the ripple effect to my lower api devices without loosing my background color?
Thanks in advance.
Found a solution for me:
add RelativeLayout with background color
add RelativeLayout with android:background="?attr/selectableItemBackground"
insert content from listitem into inner relative layout
Solution: NavigationDrawer ListItem has background color and ripple effect, yay.
Maybe this is not quite an ActionBar problem but the problem is as follows;
I have an EditText and when you long click on the EditText, text selection options appear on ActionBar's position by default. My problem is that, both the texts and background are white, so they cannot be read. Here is the screenshot:
I tried some possible causes of the problem but nothing helped. For example, I tried to change the theme
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
However, any theme with the AppCompat results totally white.
Also I changed the project theme in Android Studio's interface as follows:
However it's still white.
The copy-paste options are there and you can click on them, but how can I make them appear? Another solution on SA suggested manually replacing gray icons. But I believe this is not the usual case in Android and there should be another way. Any ideas?
I am designing an app with Material Design, but I am having trouble styling the ActionBar.
First of all, I can not get the ActionBar to render a shadow. I have tried setting the elevation in multiple ways:
In the styles.xml (v21):
<item name="android:elevation">4dp</item>
<item name="elevation">4dp</item>
In the onCreate() method
getActionBar().setElevation(4);
However, none of these result in the ActionBar rendering a shadow. Not sure if this is important, but I am running Android 5.0.1 Lollipop. What am I missing in trying to render a shadow? I don't really want to make a drawable shadow and set it as the window background.
Secondly, my ActionBar buttons are square, and when I click on them, the ripple is cut off in a square, while in other apps I have used the mask for the ripples has been circular, and my app had been using round buttons, but recently it changed and I don't know why. Could I have accidentaly changed something making them square?
Thank you
The issue is that u use ActionBar while the other apps use ToolBar. Read about and change your code, everything should work after that.