当前位置: 首页>>代码示例>>Java>>正文


Java ShapeDrawable.setPadding方法代码示例

本文整理汇总了Java中android.graphics.drawable.ShapeDrawable.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java ShapeDrawable.setPadding方法的具体用法?Java ShapeDrawable.setPadding怎么用?Java ShapeDrawable.setPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.drawable.ShapeDrawable的用法示例。


在下文中一共展示了ShapeDrawable.setPadding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDefaultOverButtonBgDrawable

import android.graphics.drawable.ShapeDrawable; //导入方法依赖的package包/类
private StateListDrawable createDefaultOverButtonBgDrawable() {
    int dp12 = (int) ThemeUtils.applyDimensionDp(this, 12.f);
    int dp8 = (int) ThemeUtils.applyDimensionDp(this, 8.f);
    float dp4 = ThemeUtils.applyDimensionDp(this, 4.f);
    float[] round = new float[]{dp4, dp4, dp4, dp4, dp4, dp4, dp4, dp4};
    ShapeDrawable pressedDrawable = new ShapeDrawable(new RoundRectShape(round, null, null));
    pressedDrawable.setPadding(dp12, dp8, dp12, dp8);
    int pressedColor = ThemeUtils.resolveColor(this, R.attr.gallery_toolbar_over_button_pressed_color, R.color.gallery_default_toolbar_over_button_pressed_color);
    pressedDrawable.getPaint().setColor(pressedColor);

    int normalColor = ThemeUtils.resolveColor(this, R.attr.gallery_toolbar_over_button_normal_color, R.color.gallery_default_toolbar_over_button_normal_color);
    ShapeDrawable normalDrawable = new ShapeDrawable(new RoundRectShape(round, null, null));
    normalDrawable.setPadding(dp12, dp8, dp12, dp8);
    normalDrawable.getPaint().setColor(normalColor);

    StateListDrawable stateListDrawable = new StateListDrawable();
    stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, pressedDrawable);
    stateListDrawable.addState(new int[]{}, normalDrawable);

    return stateListDrawable;
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:22,代码来源:MediaActivity.java

示例2: 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);
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:22,代码来源:ColorPickerAdapter.java

示例3: 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);
}
 
开发者ID:ryanlijianchang,项目名称:AdPlayBanner,代码行数:14,代码来源:PointView.java


注:本文中的android.graphics.drawable.ShapeDrawable.setPadding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。