本文整理汇总了Java中android.graphics.Outline.setOval方法的典型用法代码示例。如果您正苦于以下问题:Java Outline.setOval方法的具体用法?Java Outline.setOval怎么用?Java Outline.setOval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Outline
的用法示例。
在下文中一共展示了Outline.setOval方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clipPathInternal
import android.graphics.Outline; //导入方法依赖的package包/类
private void clipPathInternal() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() {
@Override
@SuppressWarnings("NewApi")
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, getWidth(), getHeight());
}
};
setOutlineProvider(viewOutlineProvider);
setClipToOutline(true);
} else {
onSizeChanged(getWidth(), getHeight(), 0, 0);
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
invalidate();
}
示例2: drawElevation
import android.graphics.Outline; //导入方法依赖的package包/类
/**
* Draws the elevation around the main circle
* <p>
* Stroke corrective is used due to ambiguity in drawing stroke in
* combination with elevation enabled (for API 21 and higher only.
* In such case there is no possibility to determine the accurate
* <b>Action Button</b> size, so width and height must be corrected
* <p>
* This logic may be changed in future if the better solution is found
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected void drawElevation() {
float halfSize = getSize() / 2;
final int left = (int) (calculateCenterX() - halfSize);
final int top = (int) (calculateCenterY() - halfSize);
final int right = (int) (calculateCenterX() + halfSize);
final int bottom = (int) (calculateCenterY() + halfSize);
ViewOutlineProvider provider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(left, top, right, bottom);
}
};
setOutlineProvider(provider);
LOGGER.trace("Drawn the Action Button elevation");
}
示例3: onCreateView
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View root = inflater.inflate(R.layout.fragment_explorer, container, false);
mListView = (ListView) root.findViewById(R.id.list_view);
mFabPaste = (ImageButton) root.findViewById(R.id.fab_paste);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//Outline
final ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
final int size = getResources().getDimensionPixelSize(R.dimen.fab_size);
outline.setOval(0, 0, size, size);
}
};
mFabPaste.setOutlineProvider(viewOutlineProvider);
}
return root;
}
示例4: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(view.getPaddingLeft(),
view.getPaddingTop(),
view.getWidth() - view.getPaddingRight(),
view.getHeight() - view.getPaddingBottom());
}
示例5: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
public void getOutline(View view, Outline outline) {
Rect rect = new Rect();
view.getGlobalVisibleRect(rect);
Rect selfRect = RectUtils.getOvalRect(rect);
if(mRect!=null){
selfRect = mRect;
}
outline.setOval(selfRect);
}
示例6: onSizeChanged
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, view.getWidth(), view.getHeight());
}
};
setOutlineProvider(viewOutlineProvider);
setClipToOutline(true);
}
示例7: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(Outline outline) {
Rect bounds = getBounds();
int radius = (int) ((Math.min(bounds.width(), bounds.height()) / 2) * 0.95f);
int cx = bounds.centerX();
int cy = bounds.centerY();
outline.setOval(cx - radius, cy - radius, cx + radius, cy + radius);
}
示例8: makeShapeByOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
@TargetApi(21)
public void makeShapeByOutline(ShapeImageView view, Outline outline) {
final int width = view.getMeasuredWidth();
final int height = view.getMeasuredHeight();
final int radius = width > height ? height : width;
final int left = (width - radius) / 2;
final int top = (height - radius) / 2;
final int right = left + radius;
final int bottom = top + radius;
outline.setOval(left, top, right, bottom);
}
示例9: onSizeChanged
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
Outline outline = new Outline();
outline.setOval(0, 0, w, h);
setOutline(outline);
setClipToOutline(true);
}
示例10: setOutlines
import android.graphics.Outline; //导入方法依赖的package包/类
private void setOutlines(View v) {
int size = getResources().getDimensionPixelSize(R.dimen.floating_button_size);
Outline outline = new Outline();
outline.setOval(0, 0, size, size);
v.setOutline(outline);
v.animate().alpha(1.0f);
}
示例11: setOutlines
import android.graphics.Outline; //导入方法依赖的package包/类
private void setOutlines(int star, int info) {
final int size = getResources().getDimensionPixelSize(R.dimen.floating_button_size);
final ViewOutlineProvider vop = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, size, size);
}
};
findViewById(star).setOutlineProvider(vop);
findViewById(info).setOutlineProvider(vop);
}
示例12: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
public void getOutline(View view, Outline outline)
{
outline.setOval(view.getPaddingLeft(), view.getPaddingTop(), view.getWidth() - view.getPaddingRight(), view.getHeight() - view.getPaddingBottom());
}
示例13: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
public void getOutline(Outline outline) {
copyBounds(mRect);
outline.setOval(mRect);
}
示例14: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
public void getOutline(Outline outline) {
copyBounds(this.mRect);
outline.setOval(this.mRect);
}
示例15: getOutline
import android.graphics.Outline; //导入方法依赖的package包/类
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, width, height);
}