StickyFlagView - 仿QQ消息提示拖拽的粘性效果

jopen 9年前

StickyFlagView

StickyFlagView - 仿QQ消息提示拖拽的粘性效果

Usage

  • In XML:

    1.default flag view

    <com.wj.sticky.StickyFlagView
      android:layout_width="40dp"
      android:layout_height="40dp"
      app:flagRadius="10dp" />

    2.flag view with drawable resource 

    <com.wj.sticky.StickyFlagView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:flagDrawable="@drawable/bubble"
      app:flagColor="#f74c31" />

  • In code:

    StickyFlagView sfv = new StickyFlagView(MainActivity.this);
    sfv.setFlagText("9");
    sfv.setFlagTextColor(Color.WHITE);
    sfv.setFlagTextSize(15);
    sfv.setFlagColor(Color.RED);
    sfv.setFlagRadius(10);
    sfv.setMinStickRadius(3);
    sfv.setMaxStickRadius(8);
    sfv.setMaxDistance(80);
    sfv.setOnFlagDisappearListener(new StickyFlagView.OnFlagDisappearListener() {
      @Override
      public void onFlagDisappear(StickyFlagView view) {
      }
    });

项目地址: https://github.com/weijia1991/StickyFlagView