I happened to make a semi-finished app before, and the homepage used it just to achieve the main effect of the question. I will post the link first: Click here, there are comments inside
PS: Maybe the author of the question has left, but I still write an update. I encountered a similar need today
🎜Activity should inherit from AppCompatActivity.🎜2.🎜
mSScrollView.setOnScrollListener(new SScrollView.OnScrollChangedListener() {
@Override
public void onScrollChanged(int x, int y, int oldX, int oldY) {
//状态栏透明度回调
final int height = mFLViewpagerHeight - mTitleHeight;
if (y <= 0) { //设置标题的背景颜色
mVGTitle.setBackgroundColor(Color.argb((int) 0, 255,255,255));
mTvTitleMiddle.setTextColor(Color.argb((int) 0, 46,46,46));
//这是填充在状态栏的View
mStatusBar.setBackgroundColor(Color.argb((int) 0, 204,204,204));
mIvTitleLeft.setImageResource(R.drawable.ic_arrow_left_white);
mIvTitleShare.setImageResource(R.drawable.ic_share_pure);
} else if (y > 0 && y <= height) { //滑动距离小于banner图的高度时,设置背景和字体颜色颜色透明度渐变
float scale = (float) y / height;
float alpha = (255 * scale);
mTvTitleMiddle.setTextColor(Color.argb((int) alpha, 46,46,46));
mVGTitle.setBackgroundColor(Color.argb((int) alpha, 255,255,255));
mStatusBar.setBackgroundColor(Color.argb((int) alpha, 204,204,204));
mIvTitleLeft.setImageResource(R.drawable.ic_arrow_left_white);
mIvTitleShare.setImageResource(R.drawable.ic_share_pure);
} else { //滑动到banner下面设置普通颜色
mVGTitle.setBackgroundColor(Color.argb((int) 255, 255,255,255));
mTvTitleMiddle.setTextColor(Color.argb((int) 255, 46,46,46));
mStatusBar.setBackgroundColor(Color.argb((int) 255, 204,204,204));
mIvTitleLeft.setImageResource(R.drawable.ic_left_arrow_dark);
mIvTitleShare.setImageResource(R.drawable.ic_share_dark);
}
🎜Now you can use your status bar. You can fill the status bar with a View and then change the background transparency of this View as needed🎜
ol>
🎜I used ScrollView to do it, so I monitored the scrolling distance and posted my processing: 🎜
rrreee
🎜I don’t know if this can play videos. I recorded a demo using studio. Let’s see if it can achieve your effect. It’s too slow to upload screenshots🎜http://oahzrw11n.bkt.clouddn....🎜
I happened to make a semi-finished app before, and the homepage used it just to achieve the main effect of the question. I will post the link first:
Click here, there are comments inside
I’m here to update:
Let’s look at the layout first (give me an example here):
Then modify the method in StatusBarUtil (note the level):
Demo picture:

It’s up to you to fine-tune the specific effects of your project
-----Update again:
The carousel has
OnPageChangeListener();
dynamic settings and it’s okOnPageChangeListener();
动态的设置就可以了/ 2016-10-20 更新答案 */
PS:可能题主已经走了,但是还是写下一下更新,今天碰到类似的需求
Activity
要继承AppCompatActivity
.2.
这个时候你的状态栏你就可以使用了.你可以在状态栏填充一个
View
然后按需求改变这个View的背景透明度我的 是用
/ 2016-10-20 Updated answer */ScrollView
PS: Maybe the author of the question has left, but I still write an update. I encountered a similar need today
Activity
should inherit fromAppCompatActivity
.🎜2.🎜View
and then change the background transparency of this View as needed🎜ScrollView
to do it, so I monitored the scrolling distance and posted my processing: 🎜 rrreee 🎜I don’t know if this can play videos. I recorded a demo using studio. Let’s see if it can achieve your effect. It’s too slow to upload screenshots🎜http://oahzrw11n.bkt.clouddn....🎜