Java Code Examples for android.view.View.setClipToOutline()

The following are Jave code examples for showing how to use setClipToOutline() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: pius1   File: CardViewApi21.java   Source Code and License Vote up 6 votes
@Override
public void initialize(CardViewDelegate cardView, Context context, int backgroundColor,
        float radius, float elevation, float maxElevation) {
    final RoundRectDrawable backgroundDrawable = new RoundRectDrawable(backgroundColor, radius);
    cardView.setBackgroundDrawable(backgroundDrawable);
    View view = (View) cardView;
    view.setClipToOutline(true);
    view.setElevation(elevation);
    setMaxElevation(cardView, maxElevation);
}
 
Example 2
Project: boohee_v5.6   File: CardViewApi21.java   Source Code and License Vote up 6 votes
public void initialize(CardViewDelegate cardView, Context context, int backgroundColor, float radius, float elevation, float maxElevation) {
    cardView.setBackgroundDrawable(new RoundRectDrawable(backgroundColor, radius));
    View view = (View) cardView;
    view.setClipToOutline(true);
    view.setElevation(elevation);
    setMaxElevation(cardView, maxElevation);
}
 
Example 3
Project: ColoredProgressBar   File: ColoredProgress.java   Source Code and License Vote up 5 votes
private void initialize(Context context) {
    LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    rootView = inflater.inflate(R.layout.colored_progress, this, true);
    progressElementsContainer = rootView.findViewById(R.id.container_progress);
    View progressContainer = rootView.findViewById(R.id.container_progress_x);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        progressContainer.setClipToOutline(true);
    }

    greyScaleColor = ContextCompat.getColor(context, R.color.greyscale_progress);
}
 
Example 4
Project: FlipLayout   File: FlipLayout.java   Source Code and License Vote up 5 votes
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
    super.addView(child, index, params);
    int i;
    if (index == -1) {
        i = getChildCount() - 1;
    } else {
        i = index;
    }
    child.setVisibility(i == visibleChild ? VISIBLE : INVISIBLE);
    child.setClipToOutline(false);
}
 
Example 5
Project: ToggleButtons   File: ToggleGroupApi21.java   Source Code and License Vote up 5 votes
@Override
public void initialize(ToggleGroupDelegate groupView, Context context,
                       ColorStateList backgroundColor, float radius, float elevation, float maxElevation) {
	final RoundRectDrawable background = new RoundRectDrawable(backgroundColor, radius);
	groupView.setGroupBackground(background);

	View view = groupView.getToggleGroup();
	view.setClipToOutline(true);
	view.setElevation(elevation);
	setMaxElevation(groupView, maxElevation);
}
 
Example 6
Project: aos-Video   File: RoundedRectHelperApi21.java   Source Code and License Vote up 4 votes
public static void setClipToRoundedOutline(View view, boolean clip) {
    view.setOutlineProvider(clip ? sOutlineProvider : ViewOutlineProvider.BACKGROUND);
    view.setClipToOutline(clip);
}