美文网首页我爱编程
2018-04-09工作日志,沉浸式状态栏PopupWindow

2018-04-09工作日志,沉浸式状态栏PopupWindow

作者: IT枫 | 来源:发表于2018-04-09 11:22 被阅读499次

1设置控件透明度

代码动态实现

        View.setAlpha(0.5f);
        View.setBackgroundColor(getColor_(R.color.color_333333));

xml布局实现

    <View
        android:alpha="0.5"
        android:background="@color/color_333333" />

2沉浸式状态栏下显示PopupWindow

状态栏没有覆盖到

沉浸式状态栏显示PopupWindow,全屏效果


全屏效果

实现代码

    public static void fitPopupWindowOverStatusBar(PopupWindow mPopupWindow, boolean needFullScreen) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            try {
                Field mLayoutInScreen = PopupWindow.class.getDeclaredField("mLayoutInScreen");
                mLayoutInScreen.setAccessible(needFullScreen);
                mLayoutInScreen.set(mPopupWindow, needFullScreen);
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }

3Glide加载Gif图速率慢的问题

原Gif图速率


bg_my_gif.gif

Glide加载该图

Glide.with(this).load(R.mipmap.bg_my_gif).asGif()
.diskCacheStrategy(DiskCacheStrategy.ALL).into(img_wave);

效果慢如蜗牛,就不上效果图了。
(2018年5月9号)说明:现在Glide默认支持gif格式了,并且不存在速率慢的问题了。

Glide.with(this).load(R.mipmap.bg_my_gif)
.diskCacheStrategy(DiskCacheStrategy.ALL).into(img_wave);

解决办法:使用这个框架

引入包

    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'

使用很简单

            <pl.droidsonroids.gif.GifImageView
                android:id="@+id/img_wave"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="fitXY"
                android:src="@mipmap/bg_my_gif" />

相关文章

网友评论

    本文标题:2018-04-09工作日志,沉浸式状态栏PopupWindow

    本文链接:https://www.haomeiwen.com/subject/pjnbhftx.html