本文整理匯總了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);
}