本文整理汇总了Java中android.graphics.drawable.ClipDrawable.HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Java ClipDrawable.HORIZONTAL属性的具体用法?Java ClipDrawable.HORIZONTAL怎么用?Java ClipDrawable.HORIZONTAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.drawable.ClipDrawable
的用法示例。
在下文中一共展示了ClipDrawable.HORIZONTAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RATINGBAR_PROGERSS_DRAWABLE
/** RatingBar 星星 */
public static Drawable RATINGBAR_PROGERSS_DRAWABLE() {
Drawable[] layers = new Drawable[3];
Drawable darwable1 = getDrawable(IcomoonIcon.ICON_IC_STAR_NORMAL, NUMBER_3_INT,10,10);
Drawable darwable2 = getDrawable(IcomoonIcon.ICON_IC_STAR_NORMAL, NUMBER_3_INT,10,10);
Drawable darwable3 = getDrawable(IcomoonIcon.ICON_IC_STAR_SOLID, NUMBER_3_INT,10,10);
layers[0] = darwable1;
layers[1] = new ClipDrawable(darwable2, Gravity.LEFT, ClipDrawable.HORIZONTAL);
layers[2] = new ClipDrawable(darwable3, Gravity.LEFT, ClipDrawable.HORIZONTAL);
LayerDrawable drawable = new LayerDrawable(layers);
drawable.setId(0, android.R.id.background);
drawable.setId(1, android.R.id.secondaryProgress);
drawable.setId(2, android.R.id.progress);
return drawable;
}
示例2: buildRatingBarDrawables
private Drawable buildRatingBarDrawables(Bitmap[] images) {
final int[] requiredIds = { android.R.id.background, android.R.id.secondaryProgress, android.R.id.progress };
final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
Drawable[] pieces = new Drawable[3];
for (int i = 0; i < 3; i++) {
ShapeDrawable sd = new ShapeDrawable(new RoundRectShape(roundedCorners, null, null));
BitmapShader bitmapShader = new BitmapShader(images[i], Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
sd.getPaint().setShader(bitmapShader);
ClipDrawable cd = new ClipDrawable(sd, Gravity.LEFT, ClipDrawable.HORIZONTAL);
if (i == 0) {
pieces[i] = sd;
} else {
pieces[i] = cd;
}
}
LayerDrawable ld = new LayerDrawable(pieces);
for (int i = 0; i < 3; i++) {
ld.setId(i, requiredIds[i]);
}
return ld;
}
示例3: applyProgressBarSettings
private void applyProgressBarSettings() {
if (mHeaderProgressBar != null) {
final int strokeWidth = mHeaderProgressBar.getResources()
.getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);
mHeaderProgressBar.setIndeterminateDrawable(
new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
.color(mProgressDrawableColor)
.width(strokeWidth)
.build());
ShapeDrawable shape = new ShapeDrawable();
shape.setShape(new RectShape());
shape.getPaint().setColor(mProgressDrawableColor);
ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);
mHeaderProgressBar.setProgressDrawable(clipDrawable);
}
}
示例4: applyProgressBarSettings
private void applyProgressBarSettings() {
if (mHeaderProgressBar != null) {
final int strokeWidth = mHeaderProgressBar.getResources()
.getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);
mHeaderProgressBar.setIndeterminateDrawable(
new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
.color(mProgressDrawableColor)
.strokeWidth(strokeWidth)
.build());
ShapeDrawable shape = new ShapeDrawable();
shape.setShape(new RectShape());
shape.getPaint().setColor(mProgressDrawableColor);
ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);
mHeaderProgressBar.setProgressDrawable(clipDrawable);
}
}
示例5: createSeekBarDrawable
private final LayerDrawable createSeekBarDrawable( int fg_color ) {
LayerDrawable ld = null;
try {
Drawable[] list = new Drawable[2];
final int bg_color = 0xff9d9e9d;
GradientDrawable bg = Utils.getShadingEx( atRight ? fg_color : bg_color, 0.6f );
bg.setCornerRadius( 5 );
list[0] = bg;
GradientDrawable fg = Utils.getShadingEx( atRight ? bg_color : fg_color, 0.6f );
fg.setCornerRadius( 5 );
list[1] = new ClipDrawable( fg, Gravity.LEFT, ClipDrawable.HORIZONTAL );
ld = new LayerDrawable( list );
ld.setId( 0, android.R.id.background );
ld.setId( 1, android.R.id.progress );
}
catch( Exception e ) {
e.printStackTrace();
}
return ld;
}
示例6: setFilledDrawable
public void setFilledDrawable(Drawable drawable) {
if (drawable.getConstantState() == null) {
return;
}
ClipDrawable clipDrawable = new ClipDrawable(drawable.getConstantState().newDrawable(), Gravity.START, ClipDrawable.HORIZONTAL);
mFilledView.setImageDrawable(clipDrawable);
}
示例7: setEmptyDrawable
public void setEmptyDrawable(Drawable drawable) {
if (drawable.getConstantState() == null) {
return;
}
ClipDrawable clipDrawable = new ClipDrawable(drawable.getConstantState().newDrawable(), Gravity.END, ClipDrawable.HORIZONTAL);
mEmptyView.setImageDrawable(clipDrawable);
}
示例8: PSlider_
public PSlider_(AppRunner appRunner) {
super(appRunner.getAppContext());
super.setMax(MAX_VALUE);
// setProgressDrawable(getResources().getDrawable(R.drawable.ui_seekbar_progress));
mSlider = this;
// getStyles = new Styler(appRunner, this);
//Custom background drawable allows you to draw how you want it to look if needed
// SeekBarBackgroundDrawable backgroundDrawable = new SeekBarBackgroundDrawable(appRunner.getAppContext());
ColorDrawable progressDrawable = new ColorDrawable(Color.BLUE);
SeekBarProgressDrawable clipProgressDrawable = new SeekBarProgressDrawable(progressDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL, appRunner.getAppContext());
ColorDrawable progressDrawable2 = new ColorDrawable(Color.GREEN);
//Custom seek bar slider drawable. Also allows you to modify appearance.
InsetDrawable insetDrawable = new InsetDrawable(progressDrawable2, 0, 0, 0, 0);
Drawable[] drawables = new Drawable[]{ insetDrawable, clipProgressDrawable };
//Create layer drawables with android pre-defined ids
LayerDrawable layerDrawable = new LayerDrawable(drawables);
// layerDrawable.setId(0,android.R.id.background);
// layerDrawable.setId(1,android.R.id.slider);
//Set to seek bar
setThumb(null);
setProgressDrawable(layerDrawable);
}
示例9: refreshDrawable
protected void refreshDrawable(final Drawable drawable) {
mDrawable = drawable;
if (mDrawable == null) {
mDrawable = new ColorDrawable(mColor);
}
int gravity = GRAVITY_FILL_VERTICAL | GRAVITY_LEFT;
int orientation = ClipDrawable.HORIZONTAL;
switch (mRotation) {
case 90:
gravity = GRAVITY_FILL_HORIZONTAL | GRAVITY_BOTTOM;
orientation = ClipDrawable.VERTICAL;
break;
case 180:
gravity = GRAVITY_FILL_VERTICAL | GRAVITY_RIGHT;
orientation = ClipDrawable.HORIZONTAL;
break;
case 270:
gravity = GRAVITY_FILL_HORIZONTAL | GRAVITY_TOP;
orientation = ClipDrawable.VERTICAL;
break;
}
mClipDrawable = new ClipDrawable(mDrawable, gravity, orientation);
final Rect outRect = new Rect();
getDrawingRect(outRect);
mClipDrawable.setBounds(outRect);
mClipDrawable.setLevel((int)(mProgress * mScale) + mMin);
postInvalidate();
}
示例10: initProgress
private void initProgress(Context context) {
if (mProgressbar == null) {
mProgressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
mProgressbar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 12, 0, 0));
mProgressbar.setMax(100);
mProgressbar.setProgress(0);
mProgressbar.setBackgroundColor(0xffcccccc);
ClipDrawable d = new ClipDrawable(new ColorDrawable(mProgressColor), Gravity.START, ClipDrawable.HORIZONTAL);
mProgressbar.setProgressDrawable(d);
}
if (indexOfChild(mProgressbar) == -1) {
addView(mProgressbar);
}
}
示例11: setMaskOrientation
/**
* 设置方向
* @param orientation {@link MaskOrientation}
*/
public void setMaskOrientation(int orientation){
switch (orientation){
case MaskOrientation.LeftToRight:
gravity = Gravity.LEFT;
orientaion = ClipDrawable.HORIZONTAL;
break;
case MaskOrientation.RightToLeft:
gravity = Gravity.RIGHT;
orientaion = ClipDrawable.HORIZONTAL;
break;
case MaskOrientation.TopToBottom:
gravity = Gravity.TOP;
orientaion = ClipDrawable.VERTICAL;
break;
case MaskOrientation.BottomToTop:
default:
gravity = Gravity.BOTTOM;
orientaion = ClipDrawable.VERTICAL;
break;
}
if(maskDrawable == null){
return;
}
clipDrawable = new ClipDrawable(maskDrawable, gravity, orientaion);
initAnim();
}
示例12: applyProgressBarSettings
private void applyProgressBarSettings() {
if (mHeaderProgressBar != null) {
ShapeDrawable shape = new ShapeDrawable();
shape.setShape(new RectShape());
shape.getPaint().setColor(mProgressDrawableColor);
ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);
mHeaderProgressBar.setProgressDrawable(clipDrawable);
}
}
示例13: tileify
private Drawable tileify(Drawable drawable, boolean clip) {
if (drawable instanceof DrawableWrapper) {
Drawable inner = ((DrawableWrapper) drawable).getWrappedDrawable();
if (inner != null) {
inner = tileify(inner, clip);
((DrawableWrapper) drawable).setWrappedDrawable(inner);
}
} else if (drawable instanceof LayerDrawable) {
LayerDrawable background = (LayerDrawable) drawable;
final int N = background.getNumberOfLayers();
Drawable[] outDrawables = new Drawable[N];
for (int i = 0; i < N; i++) {
int id = background.getId(i);
outDrawables[i] = tileify(background.getDrawable(i),
(id == android.R.id.progress || id == android.R.id.secondaryProgress));
}
LayerDrawable newBg = new LayerDrawable(outDrawables);
for (int i = 0; i < N; i++) {
newBg.setId(i, background.getId(i));
}
return newBg;
} else if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
bitmapDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
return (clip) ? new ClipDrawable(bitmapDrawable, Gravity.LEFT,
ClipDrawable.HORIZONTAL) : bitmapDrawable;
}
return drawable;
}
示例14: createHeader
/**
* Riga grigia cra spazio
*/
private void createHeader() {
if (collected.getIconResourceId() != 0)
FontAwesomeUtil.prepareAwesomeFontAweTextView(getActivity(), nodeic, SimpleTagViewUtils.getAwesomeNames(getActivity()).get(collected.getIconResourceId()));
par.setMax(Constants.MAX_HEALTH);
// ProgressBar sfumata
final ShapeDrawable pgDrawable = new ShapeDrawable(new RoundRectShape(Constants.roundedCorners, null, null));
final LinearGradient gradient = new LinearGradient(0, 0, 250, 0, getResources().getColor(color.aa_red),
getResources().getColor(color.aa_green), android.graphics.Shader.TileMode.CLAMP);
// pgDrawable.getPaint().setStrokeWidth(3);
pgDrawable.getPaint().setDither(true);
pgDrawable.getPaint().setShader(gradient);
ClipDrawable progress = new ClipDrawable(pgDrawable, Gravity.START, ClipDrawable.HORIZONTAL);
par.setBackgroundResource(android.R.drawable.progress_horizontal);
par.setProgressDrawable(progress);
par.setMax(50);
par.setProgress(20);
par.setProgress(0); // <-- BUG Android
par.setMax(Constants.MAX_HEALTH);
refreshHeader();
Log.d(Constants.TAG,
"Setting bar at " + collected.getHealth() + " win width=" + SoulissApp.getDisplayWidth() / 2);
}
示例15: createDrawables
private Drawable[] createDrawables(Bitmap[] bitmaps) {
Drawable[] pieces = new Drawable[bitmaps.length];
for (int i = 0; i < bitmaps.length; i++) {
BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), bitmaps[i]);
bitmapDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
if (i == 0) {
pieces[i] = bitmapDrawable;
} else {
pieces[i] = new ClipDrawable(bitmapDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
}
}
return pieces;
}