How to make a ActionBar like Google Play that fade

2019-01-05 07:09发布

How to make transparent or translucent ActionBar like Google Play that fades in or out when scrolling using windowActionBarOverlay?

Check the following screenshots

**enter image description here**

8条回答
Melony?
2楼-- · 2019-01-05 07:54

Please check this library https://github.com/ManuelPeinado/FadingActionBar which implements the cool fading action bar effect that you want

查看更多
The star\"
3楼-- · 2019-01-05 07:54

On webView:

@JavascriptInterface
public void showToolbar(String scrollY, String imgWidth) {
    int int_scrollY = Integer.valueOf(scrollY);
    int int_imgWidth = Integer.valueOf(imgWidth);

    String clr;
    if (int_scrollY<=int_imgWidth-actionBarHeight) {
        clr = Integer.toHexString(int_scrollY * 255 / (int_imgWidth-actionBarHeight));
    }else{
        clr = Integer.toHexString(255);
    }

    toolbar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#"+clr+"9CCC65")));
}
查看更多
登录 后发表回答