本文整理汇总了Java中android.graphics.drawable.ShapeDrawable.setIntrinsicHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ShapeDrawable.setIntrinsicHeight方法的具体用法?Java ShapeDrawable.setIntrinsicHeight怎么用?Java ShapeDrawable.setIntrinsicHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.ShapeDrawable
的用法示例。
在下文中一共展示了ShapeDrawable.setIntrinsicHeight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildColorPickerView
import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
private void buildColorPickerView(View view, int colorCode) {
view.setVisibility(View.VISIBLE);
ShapeDrawable biggerCircle = new ShapeDrawable(new OvalShape());
biggerCircle.setIntrinsicHeight(20);
biggerCircle.setIntrinsicWidth(20);
biggerCircle.setBounds(new Rect(0, 0, 20, 20));
biggerCircle.getPaint().setColor(colorCode);
ShapeDrawable smallerCircle = new ShapeDrawable(new OvalShape());
smallerCircle.setIntrinsicHeight(5);
smallerCircle.setIntrinsicWidth(5);
smallerCircle.setBounds(new Rect(0, 0, 5, 5));
smallerCircle.getPaint().setColor(Color.WHITE);
smallerCircle.setPadding(10, 10, 10, 10);
Drawable[] drawables = {smallerCircle, biggerCircle};
LayerDrawable layerDrawable = new LayerDrawable(drawables);
view.setBackgroundDrawable(layerDrawable);
}
示例2: createOvalShape
import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
/**
* Utility methods
*/
private static ShapeDrawable createOvalShape(int size, int color) {
ShapeDrawable shape = new ShapeDrawable(new OvalShape());
shape.setIntrinsicHeight(size);
shape.setIntrinsicWidth(size);
shape.getPaint().setColor(color);
return shape;
}
示例3: make
import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
/**
* Creates a new circle for the Badge background.
*
* @param size the width and height for the circle
* @param color the activeIconColor for the circle
* @return a nice and adorable circle.
*/
static ShapeDrawable make(int size, int color) {
ShapeDrawable indicator = new ShapeDrawable(new OvalShape());
indicator.setIntrinsicWidth(size);
indicator.setIntrinsicHeight(size);
indicator.getPaint().setColor(color);
return indicator;
}
示例4: change
import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
private void change() {
float[] outerR = new float[]{mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2};
Shape shape = new RoundRectShape(outerR, null, null);
ShapeDrawable shapeDrawable = new ShapeDrawable(shape);
shapeDrawable.setIntrinsicHeight((int) mSize);
shapeDrawable.setIntrinsicWidth((int) mSize);
shapeDrawable.setPadding(0, 0, 0, 0);
shapeDrawable.getPaint().setColor(mColor);
shapeDrawable.getPaint().setStyle(Paint.Style.FILL);
setBackgroundDrawable(shapeDrawable);
setHeight((int) mSize);
setMinWidth((int) mSize);
}
示例5: makeShapeDrawable
import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
/**
* Make circle drawable for badge background
*
* @param color background color
* @return return colored circle drawable
*/
static ShapeDrawable makeShapeDrawable(int color) {
ShapeDrawable badgeBackground = new ShapeDrawable(new OvalShape());
badgeBackground.setIntrinsicWidth(10);
badgeBackground.setIntrinsicHeight(10);
badgeBackground.getPaint().setColor(color);
return badgeBackground;
}
示例6: setCommonTabDivider
import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
public static void setCommonTabDivider(CommonTabLayout tabLayout, @ColorInt int color, int showDividers, int padding) {
LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
linearLayout.setDividerPadding(padding);
RectShape rectShape = new RectShape();
float density = tabLayout.getResources().getDisplayMetrics().density;
ShapeDrawable shapeDrawable = new ShapeDrawable(rectShape);
shapeDrawable.setIntrinsicWidth((int) density);
shapeDrawable.setIntrinsicHeight((int) density);
shapeDrawable.getPaint().setColor(color);
shapeDrawable.getPaint().setStyle(Paint.Style.STROKE);
linearLayout.setDividerDrawable(shapeDrawable);
linearLayout.setShowDividers(showDividers);
}