package com.zzyd.webview;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.wonderkiln.blurkit.BlurLayout;
import java.util.ArrayList;
import java.util.List;
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper;
/**
* Created by Administrator on 2018/1/3.
*/
public class BlurActivity extends AppCompatActivity {
private BlurLayout blurLayout;
private RecyclerView recyclerView;
private List<String> images = new ArrayList<>();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getWindow() != null){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
if(getSupportActionBar() != null){
getSupportActionBar().hide();
}
setContentView(R.layout.blur_layout);
blurLayout = findViewById(R.id.blurLayout);
recyclerView = findViewById(R.id.listview);
recyclerView.setLayoutManager(new GridLayoutManager(this,2));
recyclerView.setAdapter(new ThisAdapter());
OverScrollDecoratorHelper.setUpOverScroll(recyclerView,OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
blurLayout.setBlurRadius(25);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
// blurLayout.invalidate();
}
});
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1230799154,4259669654&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=500808421,1575925585&fm=200&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2557022909,3736713361&fm=27&gp=0.jpg");
images.add("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2869678659,1275266194&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3655969545,3662282967&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2001847261,1610044111&fm=11&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3110094567,1509314476&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2770615963,1371439151&fm=27&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2552919264,3016693621&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1230799154,4259669654&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=500808421,1575925585&fm=200&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2557022909,3736713361&fm=27&gp=0.jpg");
images.add("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2869678659,1275266194&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3655969545,3662282967&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2001847261,1610044111&fm=11&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3110094567,1509314476&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2770615963,1371439151&fm=27&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2552919264,3016693621&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1230799154,4259669654&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=500808421,1575925585&fm=200&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2557022909,3736713361&fm=27&gp=0.jpg");
images.add("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2869678659,1275266194&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3655969545,3662282967&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2001847261,1610044111&fm=11&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3110094567,1509314476&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2770615963,1371439151&fm=27&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2552919264,3016693621&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1230799154,4259669654&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=500808421,1575925585&fm=200&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2557022909,3736713361&fm=27&gp=0.jpg");
images.add("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2869678659,1275266194&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3655969545,3662282967&fm=27&gp=0.jpg");
images.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2001847261,1610044111&fm=11&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3110094567,1509314476&fm=27&gp=0.jpg");
images.add("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2770615963,1371439151&fm=27&gp=0.jpg");
images.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2552919264,3016693621&fm=27&gp=0.jpg");
}
class ThisAdapter extends RecyclerView.Adapter<ThisAdapter.ItemViewHolder>{
@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// TextView itemView = new TextView(BlurActivity.this);
// itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,250));
// itemView.setText("Hello World!");
// itemView.setTextColor(Color.BLACK);
// itemView.setGravity(Gravity.CENTER);
// itemView.setTextColor(Color.WHITE);
ImageView imageView = new ImageView(BlurActivity.this);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
450));
return new ItemViewHolder(imageView);
}
@Override
public void onBindViewHolder(ItemViewHolder holder, int position) {
// if(position % 2 == 0){
// holder.getItemView().setBackgroundColor(Color.parseColor("#EA6F5A"));
// }else{
// holder.getItemView().setBackgroundColor(Color.parseColor("#3385FF"));
// }
Glide.with(BlurActivity.this).load(images.get(position)).into((ImageView) holder.getItemView());
}
@Override
Android高仿IOS动态高斯模糊背景
5星 · 超过95%的资源 需积分: 46 46 浏览量
2018-01-03
15:18:53
上传
评论 1
收藏 3.48MB RAR 举报
快乐的神经病
- 粉丝: 43
- 资源: 7
最新资源
- 高等数学第一章第二节数列的极限
- Python 版冒泡排序算法源代码
- tensorflow-gpu-2.7.2-cp38-cp38-manylinux2010-x86-64.whl
- tensorflow-2.7.3-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-2.7.2-cp39-cp39-manylinux2010-x86-64.whl
- Python版本快速排序源代码
- Python 语言版的快速排序算法实现
- 450815388207377安卓_base.apk
- 超微主板 X9DRE-TF+ bios 支持 nvme启动
- 基于Python通过下载气象数据和插值拟合离散数据曲线实现对寒潮过程的能量分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈