2016-12-25 5 views
1

は適用されませんぼかし、私のために働いていないが、私は相対的なレイアウトでぼやけbackroundのを持ちたいAndroidのライブラリぼやけは効果が私は私のプロジェクトのためにぼやけたライブラリを使用しています

動作するようには思えない、そうすることができます誰もがここでその

のためのいくつかのアイデアで私を助けて、私のフラグメントのコード

public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 
    imageView=(ImageView)view.findViewById(R.id.imageView2); 
    imageButton=(ImageButton)view.findViewById(R.id.imageButton); 
    imageButton2=(ImageButton)view.findViewById(R.id.imageButton2); 
    imageButton3=(ImageButton)view.findViewById(R.id.imageButton3); 
    textView=(TextView)view.findViewById(R.id.textView); 
    seekBar=(SeekBar)view.findViewById(R.id.seekBar); 
    rl=(RelativeLayout)view.findViewById(R.id.psrl); 
    rl1=(RelativeLayout)view.findViewById(R.id.rl1); 

    imageButton.setOnClickListener(this); 
    imageButton2.setOnClickListener(this); 
    imageButton3.setOnClickListener(this); 
    seekBar.setOnSeekBarChangeListener(this); 
    createMediaPlayer(); 
    setAlbumImage(); 
    runnable=new Runnable() { 
     @Override 
     public void run() { 
      seekBar.setProgress(MainActivity.mediaPlayer.getCurrentPosition()); 
      handler.postDelayed(runnable,1000); 
     } 
    }; 
    handler.postDelayed(runnable,1000); 
    rl.setBackground(d); 
    Blurry.with(getContext()).radius(25).sampling(2).async().animate(500).onto((ViewGroup)view.findViewById(R.id.psrl)); 
} 

、ここでは、XMLコード

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/psrl" 
> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:background="#7e838c" 
    android:alpha="1.0" 
    android:id="@+id/rl1"> 
<TextView 
    android:layout_width="210dp" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="15dp" 
    android:layout_marginTop="8dp" 
    android:ellipsize="marquee" 
    android:focusable="true" 
    android:focusableInTouchMode="true" 
    android:gravity="center" 
    android:marqueeRepeatLimit="marquee_forever" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:scrollHorizontally="true" 
    android:singleLine="true" 
    android:text="Medium Text" 
    android:textSize="15dp" 
    android:id="@+id/textView" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true" /> 
</RelativeLayout> 
<ImageView 
    android:layout_width="200dp" 
    android:layout_height="200dp" 
    android:id="@+id/imageView2" 
    android:layout_marginTop="109dp" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:scaleType="fitXY" 
    android:background="@drawable/ic_launcher" 
    android:adjustViewBounds="true" 
    android:padding="8dp" 
    android:alpha="1" 
    android:cropToPadding="true"/> 

<SeekBar 
    android:layout_width="370dp" 
    android:layout_height="30dp" 
    android:id="@+id/seekBar" 
    android:layout_above="@+id/imageButton" 
    android:layout_centerHorizontal="true" 
    android:layout_marginBottom="38dp" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageButton" 
    android:background="@drawable/custom2" 
    android:layout_alignParentBottom="true" 
    android:layout_marginBottom="60dp" 
    android:layout_centerHorizontal="true"/> 
<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageButton2" 
    android:background="@drawable/previous" 
    android:layout_alignTop="@+id/imageButton" 
    android:layout_alignLeft="@+id/imageView2" 
    android:layout_alignStart="@+id/imageView2" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageButton3" 
    android:background="@drawable/skip" 
    android:layout_alignTop="@+id/imageButton" 
    android:layout_alignRight="@+id/imageView2" 
    android:layout_alignEnd="@+id/imageView2" /> 

</RelativeLayout> 
0です

バックラウンドのみ設定されていますが、ぼかし効果は適用されません。ここ

はので、ここでbuild.gradle

android { 
compileSdkVersion 24 
defaultConfig { 
    applicationId "com.example.abhinav.mymusicplayer" 
    minSdkVersion 16 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
buildToolsVersion '24.0.2' 
productFlavors { 
} 
} 
repositories { 
maven { 
    url "https://jitpack.io" 

} 
} 
dependencies { 
compile 'com.android.support:support-v4:24.2.0' 
compile 'com.android.support:appcompat-v7:24.2.0' 
compile 'jp.wasabeef:blurry:2.1.0' 
compile 'com.android.support:cardview-v7:24.0.0' 
compile 'com.android.support:recyclerview-v7:24.0.0' 
compile 'com.github.moondroid.coverflow:library:1.0' 
compile 'com.github.davidschreiber:FancyCoverFlow:a54a1e7' 
compile files('libs/picasso-2.5.2.jar') 
compile files('libs/carousel-api-v1.jar') 
} 
+0

あなたのbuild.gradle(Module:app)を投稿してください。レンダースクリプトを有効にしましたか? –

+0

@KostasDrakはbuild.gradle – Abhinav422

+0

を投稿しましたが、ぼかしのためのレンダースクリプトを有効にしていません –

答えて

1

OKです私はぼやけた画像を望んでいたとき、私は、その後のステップです。

このようなあなたのbuild.gradle変更します。そのままライブラリ手順を繰り返し

android { 

    defaultConfig { 
     minSdkVersion 18 
     targetSdkVersion 25 

     renderscriptTargetApi 25 <-- must match your targetSdkVersion 
     renderscriptSupportModeEnabled true 

    } 
} 

を。これで問題が解決しない場合は、

https://github.com/jrvansuita/GaussianBlurチャームのように私のために働いた!

希望すると助かります!

+1

私は相対的なレイアウトの背景をぼかしたいのではなく、スクリーン全体をぼかします。ちょうどbckgroundをぼかす方法は? – Abhinav422

+0

build.gradleでガウスブラーエラー "com.android.support:app compat-v7:25.0.0"の解決に失敗しました。 – Abhinav422

+1

あなたのtargetsdkバージョンは何でも、ビルドツールとレンダスクリプトでなければなりません。 sdkマネージャーを介してそれらを更新しようとする –

関連する問題