Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A scrimColor / shadow issue #44

Closed
qbai22 opened this issue Feb 27, 2017 · 7 comments
Closed

A scrimColor / shadow issue #44

qbai22 opened this issue Feb 27, 2017 · 7 comments

Comments

@qbai22
Copy link

qbai22 commented Feb 27, 2017

I can't find a way to implement any activity shadowing as in your example gif, setScrimColor method is not available for FlowingDrawer object. Can you please help me?

@mxn21
Copy link
Owner

mxn21 commented Feb 27, 2017

you can check out the app/ folder and the sample app. There is no need to implement any activity. just put layout in the right way in xml . I don't understand what scrimColor mean ..

@qbai22
Copy link
Author

qbai22 commented Feb 27, 2017

Thank you for your answer! I meant this shadow (see on picture). By default and in the sample app there is no any shadow overlay. So i wanted to ask how can i achieve it?
shadow

@mxn21
Copy link
Owner

mxn21 commented Feb 28, 2017

HI, @qbai22 ,I haven't found a good way to set shadow .so I didn't use shadow. This needs to be improved.

@syn3sthete
Copy link

syn3sthete commented Mar 4, 2017

@qbai22 I have achieved the shadow effect by taking a long route.

  1. First create a window_dim.xml file in drawable folder and paste the below code:
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#000000" />
    </shape>

  2. Go to the activity where you want the shadow effect, after you have set the layout for the activity paste the below code:
    window.setForeground(ContextCompat.getDrawable(getBaseContext(), R.drawable.window_dim));
    window.getForeground().setAlpha(0);

NOTE: window the the view where you want the shadow effect.

  1. Now just use the OnDrawerStateChangeListener like the below code:

flowingDrawer.setOnDrawerStateChangeListener(new ElasticDrawer.OnDrawerStateChangeListener() {
@Override
public void onDrawerStateChange(int oldState, int newState) {
}
@Override
public void onDrawerSlide(float openRatio, int offsetPixels) {
window.getForeground().setAlpha(offsetPixels / 10);
}
});

This worked perfect for me, let me know if you have any doubts.

@qbai22
Copy link
Author

qbai22 commented Mar 5, 2017

@syn3sthete wow you did a great job! Thanks i will try it in a short time!

@syn3sthete
Copy link

@qbai22 I am sure it will work because I was also looking solution for the same problem and implemented this, anyway let know how it worked for you and close the issue if the problem is fixed. Thanks :)

@qbai22
Copy link
Author

qbai22 commented Mar 6, 2017

@syn3sthete all works great! Thanks

@qbai22 qbai22 closed this as completed Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants