How to make a ActionBar like Google Play that fades in when scrolling

前端 未结 8 918
-上瘾入骨i
-上瘾入骨i 2020-11-27 09:06

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

Check the f

8条回答
  •  心在旅途
    2020-11-27 09:41

    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")));
    }
    

提交回复
热议问题