android.view.View.setOutlineProvider()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(907)

本文整理了Java中android.view.View.setOutlineProvider()方法的一些代码示例,展示了View.setOutlineProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setOutlineProvider()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setOutlineProvider

View.setOutlineProvider介绍

暂无

代码示例

代码示例来源:origin: nickbutcher/plaid

@Override
  public void onAnimationEnd(Animator animation) {
    view.setOutlineProvider(new ViewOutlineProvider() {
      @Override
      public void getOutline(View view, Outline outline) {
        final int left = (view.getWidth() - fabBounds.width()) / 2;
        final int top = (view.getHeight() - fabBounds.height()) / 2;
        outline.setOval(
            left, top, left + fabBounds.width(), top + fabBounds.height());
        view.setClipToOutline(true);
      }
    });
  }
});

代码示例来源:origin: facebook/litho

private static void setOutlineProvider(View view, ViewOutlineProvider outlineProvider) {
 if (outlineProvider != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  view.setOutlineProvider(outlineProvider);
 }
}

代码示例来源:origin: facebook/litho

private static void unsetOutlineProvider(View view, ViewOutlineProvider outlineProvider) {
 if (outlineProvider != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  view.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
 }
}

代码示例来源:origin: qiujuer/Genius-Android

static void setOutlineProvider(View marker, final BalloonMarkerDrawable balloonMarkerDrawable) {
  marker.setOutlineProvider(new ViewOutlineProvider() {
    @Override
    public void getOutline(View view, Outline outline) {
      outline.setConvexPath(balloonMarkerDrawable.getPath());
    }
  });
}

代码示例来源:origin: jiajunhui/PlayerBase

@Override
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void setRoundRectShape(Rect rect, float radius){
  this.mView.setClipToOutline(true);
  this.mView.setOutlineProvider(new ViewRoundRectOutlineProvider(radius, rect));
}

代码示例来源:origin: bluelinelabs/Conductor

final ViewOutlineProvider fabOutlineProvider = view.getOutlineProvider();
view.setOutlineProvider(new ViewOutlineProvider() {
  boolean hasRun = false;

代码示例来源:origin: jiajunhui/PlayerBase

@Override
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void setOvalRectShape(Rect rect){
  this.mView.setClipToOutline(true);
  this.mView.setOutlineProvider(new ViewOvalRectOutlineProvider(rect));
}

代码示例来源:origin: AndroidKun/XTabLayout

static void setBoundsViewOutlineProvider(View view) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    view.setOutlineProvider(ViewOutlineProvider.BOUNDS);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Adds a rectangular outline to a view. This can be useful when you want to add a shadow
 * to a transparent view. See b/16856049.
 * @param view view that the outline is added to
 * @param res The resources file.
 */
public static void addRectangularOutlineProvider(View view, Resources res) {
  if (CompatUtils.isLollipopCompatible()) {
    view.setOutlineProvider(RECT_OUTLINE_PROVIDER);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Configures the floating action button, clipping it to a circle and setting its translation z.
 * @param view The float action button's view.
 * @param res The resources file.
 */
public static void setupFloatingActionButton(View view, Resources res) {
  view.setOutlineProvider(OVAL_OUTLINE_PROVIDER);
  view.setTranslationZ(
      res.getDimensionPixelSize(R.dimen.floating_action_button_translation_z));
}

代码示例来源:origin: rkkr/simple-keyboard

static InsetsUpdater setInsetsOutlineProvider(final View view) {
  final InsetsOutlineProvider provider = new InsetsOutlineProvider(view);
  view.setOutlineProvider(provider);
  return provider;
}

代码示例来源:origin: JustinRoom/JSCKit

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
  private void initViewShapeProvider(View targetView) {
    targetView.setClipToOutline(true);
    targetView.setOutlineProvider(new ViewOutlineProvider() {
      @Override
      public void getOutline(View view, Outline outline) {
        outline.setOval(0, 0, view.getWidth(), view.getHeight());
      }
    });
  }
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void setOutlineProvider(View view, ViewOutlineProvider provider) {
  view.setOutlineProvider(new ViewOutlineProviderLollipop(provider));
}

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Configures the floating action button, clipping it to a circle and setting its translation z.
 * @param view The float action button's view.
 * @param res The resources file.
 */
public static void setupFloatingActionButton(View view, Resources res) {
  if (CompatUtils.isLollipopCompatible()) {
    view.setOutlineProvider(OVAL_OUTLINE_PROVIDER);
    view.setTranslationZ(
        res.getDimensionPixelSize(R.dimen.floating_action_button_translation_z));
  }
}

代码示例来源:origin: fookwood/Launcher3

public void onAnimationStart(Animator animation) {
  revealView.setOutlineProvider(outlineProvider);
  revealView.setClipToOutline(true);
  revealView.setTranslationZ(-elevation);
}

代码示例来源:origin: fookwood/Launcher3

public void onAnimationEnd(Animator animation) {
  revealView.setOutlineProvider(originalProvider);
  revealView.setClipToOutline(false);
  revealView.setTranslationZ(0);
}

代码示例来源:origin: enricocid/LaunchEnr

public void onAnimationStart(Animator animation) {
  revealView.setOutlineProvider(RevealOutlineAnimation.this);
  revealView.setClipToOutline(true);
  if (shouldRemoveElevationDuringAnimation()) {
    revealView.setTranslationZ(-elevation);
  }
}

代码示例来源:origin: enricocid/LaunchEnr

public void onAnimationEnd(Animator animation) {
  if (!mWasCanceled) {
    revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
    revealView.setClipToOutline(false);
    if (shouldRemoveElevationDuringAnimation()) {
      revealView.setTranslationZ(0);
    }
  }
}

代码示例来源:origin: klinker24/launcher3

public void onAnimationStart(Animator animation) {
  revealView.setOutlineProvider(RevealOutlineAnimation.this);
  revealView.setClipToOutline(true);
  if (shouldRemoveElevationDuringAnimation()) {
    revealView.setTranslationZ(-elevation);
  }
}

代码示例来源:origin: klinker24/Android-Blur-Launcher

public void onAnimationEnd(Animator animation) {
  if (!mWasCanceled) {
    revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
    revealView.setClipToOutline(false);
    if (shouldRemoveElevationDuringAnimation()) {
      revealView.setTranslationZ(0);
    }
  }
}

相关文章

View类方法