Android過濾器菜單:FilterMenu

jopen 9年前發布 | 21K 次閱讀 Android開發 移動開發 FilterMenu

這個Android庫擁有一個自定義的View實現過濾器菜單效果(https://dribbble.com/shots/1956586-Filter-Menu) 。

快速查看

  • 示例 Apk

  • 截圖

    screenshot

特性

  • 易于設置它的位置
  • 自動檢測邊緣

入門使用

  • 在你的布局中定義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();

    項目主頁:http://www.baiduhome.net/lib/view/home/1426228522482

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!