Title Bar transparency changes, title bar transparency
How does one monitor the slide of A ScrollView?
@ Override public void onScrollChanged (ObservableScrollView observableScrollView, int x, int y, int oldx, int oldy) {Log. d (TAG, "onScrollChanged:" + x + "" + y + "" + oldx + "" + oldy); if (y <= 0) {mRlTitleContainer. setBackgroundColor (Color. argb (int) 0,245,119, 8); // AGB is obtained by related tools, or provided by the artist} else if (y> 0 & y <= mIvTitleBg. getHeight ()-mRlTitleContainer. getHeight () {float scale = (float) y/(mIvTitleBg. getHeight ()-mRlTitleContainer. getHeight (); float alpha = (255 * scale); // title background transparent mRlTitleContainer. setBackgroundColor (Color. argb (int) alpha, 245,119, 8);} else {mRlTitleContainer. setBackgroundColor (Color. argb (int) 255,245,119, 8 ));}}
Source code
Https://github.com/ln0491/TitleAlphaDemo