本文整理汇总了Java中android.graphics.drawable.PaintDrawable.setCornerRadius方法的典型用法代码示例。如果您正苦于以下问题:Java PaintDrawable.setCornerRadius方法的具体用法?Java PaintDrawable.setCornerRadius怎么用?Java PaintDrawable.setCornerRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.PaintDrawable
的用法示例。
在下文中一共展示了PaintDrawable.setCornerRadius方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeZoomLabel
import android.graphics.drawable.PaintDrawable; //导入方法依赖的package包/类
/**
* @param context
* @param zoomController
*/
private void makeZoomLabel(Context context, ZoomButtonsController zoomController) {
ViewGroup container = zoomController.getContainer();
View controls = zoomController.getZoomControls();
LayoutParams p0 = controls.getLayoutParams();
container.removeView(controls);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
mZoomLabel = new TextView(context);
mZoomLabel.setPadding(12, 0, 12, 0);
mZoomLabel.setTypeface(Typeface.DEFAULT_BOLD);
mZoomLabel.setTextColor(0xff000000);
PaintDrawable d = new PaintDrawable(0xeeffffff);
d.setCornerRadius(6);
mZoomLabel.setBackgroundDrawable(d);
mZoomLabel.setTextSize(20);
mZoomLabel.setGravity(Gravity.CENTER_HORIZONTAL);
LinearLayout.LayoutParams p1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
p1.gravity = Gravity.CENTER_HORIZONTAL;
layout.addView(mZoomLabel, p1);
layout.addView(controls);
container.addView(layout, p0);
}
示例2: init
import android.graphics.drawable.PaintDrawable; //导入方法依赖的package包/类
protected void init()
{
mPaintDrawable = new PaintDrawable();
mPaintDrawable.setCornerRadius(4);
mPaintDrawable.setBounds(0, 0, 30, 25);
setCompoundDrawables(mPaintDrawable, null, null, null);
setText(R.string.colorButtonText);
setOnClickListener(listener);
}
示例3: init
import android.graphics.drawable.PaintDrawable; //导入方法依赖的package包/类
public void init(){
drawable = new PaintDrawable();
paint = drawable.getPaint();
paint.setTextSize(30);
paint.setTextAlign(Paint.Align.CENTER);
drawable.setCornerRadius(15);
setBackground(drawable);
}
示例4: init
import android.graphics.drawable.PaintDrawable; //导入方法依赖的package包/类
private void init(AttributeSet attrs) {
if (attributes == null)
attributes = new Attributes(this, getResources());
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, com.cengalabs.flatui.R.styleable.fl_FlatSeekBar);
// getting common attributes
int customTheme = a.getResourceId(com.cengalabs.flatui.R.styleable.fl_FlatSeekBar_fl_theme, Attributes.DEFAULT_THEME);
attributes.setThemeSilent(customTheme, getResources());
attributes.setSize(a.getDimensionPixelSize(com.cengalabs.flatui.R.styleable.fl_FlatSeekBar_fl_size, Attributes.DEFAULT_SIZE_PX));
a.recycle();
}
// setting thumb
PaintDrawable thumb = new PaintDrawable(attributes.getColor(0));
thumb.setCornerRadius(attributes.getSize() * 9 / 8);
thumb.setIntrinsicWidth(attributes.getSize() * 9 / 4);
thumb.setIntrinsicHeight(attributes.getSize() * 9 / 4);
setThumb(thumb);
// progress
PaintDrawable progress = new PaintDrawable(attributes.getColor(1));
progress.setCornerRadius(attributes.getSize());
progress.setIntrinsicHeight(attributes.getSize());
progress.setIntrinsicWidth(attributes.getSize());
progress.setDither(true);
ClipDrawable progressClip = new ClipDrawable(progress, Gravity.LEFT, ClipDrawable.HORIZONTAL);
// secondary progress
PaintDrawable secondary = new PaintDrawable(attributes.getColor(2));
secondary.setCornerRadius(attributes.getSize());
secondary.setIntrinsicHeight(attributes.getSize());
ClipDrawable secondaryProgressClip = new ClipDrawable(secondary, Gravity.LEFT, ClipDrawable.HORIZONTAL);
// background
PaintDrawable background = new PaintDrawable(attributes.getColor(3));
background.setCornerRadius(attributes.getSize());
background.setIntrinsicHeight(attributes.getSize());
// applying drawable
LayerDrawable ld = (LayerDrawable) getProgressDrawable();
ld.setDrawableByLayerId(R.id.background, background);
ld.setDrawableByLayerId(R.id.progress, progressClip);
ld.setDrawableByLayerId(R.id.secondaryProgress, secondaryProgressClip);
}
示例5: init
import android.graphics.drawable.PaintDrawable; //导入方法依赖的package包/类
private void init(AttributeSet attrs) {
if (attributes == null)
attributes = new Attributes(this, getResources());
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs,
R.styleable.fl_FlatSeekBar);
// getting common attributes
int customTheme = a.getResourceId(
R.styleable.fl_FlatSeekBar_fl_theme,
Attributes.DEFAULT_THEME);
attributes.setThemeSilent(customTheme, getResources());
attributes.setSize(a.getDimensionPixelSize(
R.styleable.fl_FlatSeekBar_fl_size,
Attributes.DEFAULT_SIZE_PX));
a.recycle();
}
// setting thumb
PaintDrawable thumb = new PaintDrawable(attributes.getColor(0));
thumb.setCornerRadius(attributes.getSize() * 9 / 8);
thumb.setIntrinsicWidth(attributes.getSize() * 9 / 4);
thumb.setIntrinsicHeight(attributes.getSize() * 9 / 4);
setThumb(thumb);
// progress
PaintDrawable progress = new PaintDrawable(attributes.getColor(1));
progress.setCornerRadius(attributes.getSize());
progress.setIntrinsicHeight(attributes.getSize());
progress.setIntrinsicWidth(attributes.getSize());
progress.setDither(true);
ClipDrawable progressClip = new ClipDrawable(progress, Gravity.LEFT,
ClipDrawable.HORIZONTAL);
// secondary progress
PaintDrawable secondary = new PaintDrawable(attributes.getColor(2));
secondary.setCornerRadius(attributes.getSize());
secondary.setIntrinsicHeight(attributes.getSize());
ClipDrawable secondaryProgressClip = new ClipDrawable(secondary,
Gravity.LEFT, ClipDrawable.HORIZONTAL);
// background
PaintDrawable background = new PaintDrawable(attributes.getColor(3));
background.setCornerRadius(attributes.getSize());
background.setIntrinsicHeight(attributes.getSize());
// applying drawable
LayerDrawable ld = (LayerDrawable) getProgressDrawable();
ld.setDrawableByLayerId(android.R.id.background, background);
ld.setDrawableByLayerId(android.R.id.progress, progressClip);
ld.setDrawableByLayerId(android.R.id.secondaryProgress,
secondaryProgressClip);
}