Android过滤器菜单:FilterMenu
jopen
10年前
这个Android库拥有一个自定义的View实现过滤器菜单效果(https://dribbble.com/shots/1956586-Filter-Menu) 。
快速查看
-
示例 Apk
-
截图
特性
- 易于设置它的位置
- 自动检测边缘
入门使用
-
在你的布局中定义FilterMenuLayout
<com.linroid.filtermenu.library.FilterMenuLayout android:id="@+id/filter_menu" android:layout_width="match_parent" android:layout_height="match_parent" android:elevation="8dp" custom:expandedRadius="96dp" custom:collapsedRadius="24dp" custom:centerBottom="50dp" custom:centerRight="50dp" custom:primaryColor="#ff37aa4a" custom:primaryDarkColor="#ff20622b"> </com.linroid.filtermenu.library.FilterMenuLayout> <!--circle radius size when menu expanded--> custom:expandedRadius <!--circle radius size when menu collapsed--> custom:collapsedRadius <!--set the position of circle, the menu will auto align. You should only set two directions at most.--> custom:center[Left|Top|Right|Bottom] <!--primary color--> custom:primaryColor <!--color of inner circle when menu expanded--> custom:primaryDarkColor
-
通过Java代码初始化菜单项
FilterMenuLayout layout = (FilterMenuLayout) findViewById(R.id.filter_menu); FilterMenu menu = new FilterMenu.Builder(this) .addItem(R.drawable...) .addItem(R.drawable...) .attach(layout) .withListener(new FilterMenu.OnMenuChangeListener() { @Override public void onMenuItemClick(View view, int position) { } @Override public void onMenuCollapse() { } @Override public void onMenuExpand() { } }) .build();