简体   繁体   中英

Android ActionBar on Lollipop not styling correctly

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM