BlurredGridMenu
介绍:
模糊效果的网格菜单,参照了500px-android-blur项目的模糊实现方式
运行效果:
使用说明:
启用renderscript
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
代码
// Configuration
private void makeBlurConfig() {
Config.build(new Config.Builder()
.radius(1)
.downsample(1)
.overlayColor(Color.parseColor("#000000")));
}
// GridMenuFragment
private void makeGridMenuFragment() {
// This image will be blurred.
int backgroundResourceId = ...;
mGridMenuFragment = GridMenuFragment.newInstance(backgroundResourceId)
List<MenuItem> menus = new ArrayList<>();
menus.add(new MenuItem("Home", R.drawable.home));
...
menus.add(new MenuItem(.., ..))
...
mGridMenuFragment.setMenu(menus);
mGridMenuFragment.setOnClickMenuListener(new GridMenuFragment.OnClickMenuListener() {
@Override
public void onClickMenu(MenuItem menuItem) {
Toast.makeText(context, menuItem.title, Toast.LENGTH_SHORT).show();
}
});
}
Gradle
repositories {
jcenter()
}
dependencies {
compile 'com.github.goka.blurredgridmenu:blurredgridmenu:1.0.0'
}
已下载
0