简体   繁体   English

在LinearLayout的被弄脏的背景图象

[英]Blurred background image in a LinearLayout

I saw this effect in an app named "Umano" (picture below). 我在一个名为“Umano”的应用程序中看到了这个效果(如下图所示)。 The background image is (I assume) loaded from a URL and added as a background to the layout BUT blurred as you can see. 背景图像是(我假设)从URL加载并作为背景添加到布局但是模糊,如您所见。 How can I change my code (given below) such that i can achieve this effect? 如何更改我的代码(如下所示),以便我可以实现此效果?

Image Link here 图片链接在这里

My XML: 我的XML:

<LinearLayout
       android:id="@+id/dragView"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:background="#eeeeee"
       android:clickable="true"
       android:focusable="false"
       android:orientation="vertical" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="68dp"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/name"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:gravity="center_vertical"
                    android:paddingLeft="10dp"
                    android:text="Product Details"
                    android:textSize="14sp" />
             </LinearLayout>
</LinearLayout>

You can obtain blurred images using Renderscript . 您可以使用Renderscript获取模糊图像。

Here's an official tutorial. 这是一个官方教程。

You need to perform some blurring algorithm over the image and then set it up as your background image in the layout. 您需要在图像上执行一些模糊算法,然后将其设置为布局中的背景图像。

You may find very useful the following links: 您可能会发现以下链接非常有用:

http://trickyandroid.com/advanced-blurring-techniques/ http://trickyandroid.com/advanced-blurring-techniques/

http://nicolaspomepuy.fr/blur-effect-for-android-design/ http://nicolaspomepuy.fr/blur-effect-for-android-design/

Fast Bitmap Blur For Android SDK 适用于Android SDK的快速位图模糊

Regards, Néstor 此致,Néstor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM