Android:布局后面的模糊列表视图

时间:2016-04-03 18:56:57

标签: android layout blur uiblureffect

我有一个listview和一个位于listview前面的布局。我希望那个布局能够将listview的模糊视为背景。就像在图像中。模糊根据列表视图滚动而变化。我该怎么做呢?

2 个答案:

答案 0 :(得分:3)

这个lib就是你需要的https://github.com/Dimezis/BlurView

<eightbitlab.com.blurview.BlurView
    android:id="@+id/blurView"
    android:layout_width="match_parent"
    android:layout_height="66dp"
    android:layout_alignParentBottom="true"
    >
    <!--anything below this view will be blured-->
</eightbitlab.com.blurview.BlurView>

在app.gradle defaultConfig

    renderscriptTargetApi 23
    renderscriptSupportModeEnabled true

和活动

    blurView = (BlurView) findViewById(R.id.blurView);

    final View decorView = getWindow().getDecorView();
    final View rootView = decorView.findViewById(android.R.id.content);
    final Drawable windowBackground = decorView.getBackground();

    blurView.setupWith(rootView)
            .windowBackground(windowBackground)
            .blurAlgorithm(new RenderScriptBlur(this, true)) //Preferable algorithm, needs RenderScript support mode enabled
            .blurRadius(10);

答案 1 :(得分:0)

参考此博客post

var q = 'q2';
function qty(q1) {
        var theForm = document.forms["contact-form"];
        var quantity = theForm.elements[q1]; var howmany =0;
    return howmany;
}
    document.write(qty(q));