Android Apply Blur Effect on Application Background ImageProgrammatically

June 05, 2018 , , 0 Comments

Blurry effect image is common in most of android application because using the blur image effect android developer can set normal image as awesome background. So in this tutorial we would going to make App.ly Blur Effect on Application Background Image Programmatically.

Contents in this project Apply Blur Effect on Application Background Image :


1. Open Your project’s build.gradle(Project) file.

2. Add maven { url “https://jitpack.io” } inside the allprojects -> repositories block .

3. Now open build.gradle(Module: app) file.

4. Add compile ‘com.github.jgabrielfreitas:BlurImageView:1.0.1’ inside the dependencies block.

5. Download the below image and paste into res -> drawable folder.



Code for MainActivity.java file.

package com.android_examples.blurimageview_android_examplescom;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.jgabrielfreitas.core.BlurImageView;

public class MainActivity extends AppCompatActivity {

    BlurImageView blurImageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        blurImageView = (BlurImageView)findViewById(R.id.BlurImageView);

        blurImageView.setBlur(5);
    }
}

Code for activity_main.xml layout file.

    xmlns:app="http://schemas.android.com/app"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:context="com.android_examples.blurimageview_android_examplescom.MainActivity">

            android:id="@+id/BlurImageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/nature" />


Screenshot:

The post Android Apply Blur Effect on Application Background Image Programmatically appeared first on Android Examples.

Unknown

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google

0 comments:

Popular Posts

Contact Form

Name

Email *

Message *