TabLayout放在ScrollView的根布局的时候,里面的Fragment显示不出来了,只能显示Tab部分。

如题,大家有没有使用过TabLayout(不是TableLayout表格布局啊),TabLayout+ViewPager+Fragment的搭配。这个组合如果放在ScrollView里的时候就会显示不了Viewpager里的内容了,除非把ViewPager高度写死,但是这样就会Fragment页面内容显示不完整!

这个好像是有点复杂,百度没有么,沉浸状态栏那个不是5.0的东西吗?

沉浸式状态栏容易实现,需要在style中设状态栏浮动透明,在布局中设置toolbar浮动透明就可以了。颜色透明度变化要监听事件,用代码写动画实现,比较复杂。

你想要的是沉浸式状态栏,5.0自带的


 int baseColor = getTheme().obtainStyledAttributes(R.styleable.msg_textcolor).getColor(0, getResources().getColor(R.color.theme1_blue_pure));
        float alpha = Math.min(1, (float) scrollY / (mParallaxImageHeight - 150));
        tvrToolbar.setBackgroundColor(getColorWithAlpha(alpha, baseColor));
        tvrToolbar.setTitleTextColor(getColorWithAlpha(alpha, getResources().getColor(R.color.white)));


沉浸式状态栏容易实现,需要在style中设状态栏浮动透明,在布局中设置toolbar浮动透明就可以了。颜色透明度变化要监听事件,用代码写动画实现,比较复杂。

如果要兼容4.4的可以参考下http://blog.csdn.net/baiyuliang2013/article/details/51222357,虽不完美不过是一种思路!

CollapsingToolbarLayout 你百度这个