Пример #1
0
  private void initArcMenu(ArcMenu menu, int[] itemDrawables) {
    final int itemCount = itemDrawables.length;
    for (int i = 0; i < itemCount; i++) {
      ImageView item = new ImageView(getActivity());
      item.setImageResource(itemDrawables[i]);
      final int position = i;

      menu.addItem(
          item,
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              switch (position) {
                case 0:
                  switchContent("list");
                  arcMenu.mHintView.setImageResource(R.drawable.home_list);
                  break;
                case 1:
                  switchContent("favorite");
                  arcMenu.mHintView.setImageResource(R.drawable.home_favorite);
                  break;
                case 2:
                  switchContent("calendar");
                  arcMenu.mHintView.setImageResource(R.drawable.home_calendar);
                  break;
              }
            }
          });
    }
  }
Пример #2
0
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    arcMenu = (ArcMenu) getView().findViewById(R.id.arc_menu);
    initArcMenu(arcMenu, ITEM_DRAWABLES);
    arcMenu.post(
        new Runnable() {
          @Override
          public void run() {
            RelativeLayout.LayoutParams params =
                new RelativeLayout.LayoutParams(arcMenu.getLayoutParams());
            params.addRule(RelativeLayout.ALIGN_PARENT_END);
            params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            int widthMargin = (int) (arcMenu.getWidth() / -4f);
            int widthHeight = (int) (arcMenu.getHeight() / 5f);
            params.setMargins(0, 0, widthMargin, widthHeight);
            arcMenu.setLayoutParams(params);
          }
        });

    registBtn = (Button) getView().findViewById(R.id.registBtn);
    registBtn.setOnClickListener(this);
  }