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


Java GradientDrawable.setSize方法代码示例

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


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

示例1: addPulseRing

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void addPulseRing(LatLng latLng) {
    GradientDrawable d = new GradientDrawable();
    d.setShape(GradientDrawable.OVAL);
    d.setSize(500, 500);
    d.setColor(ContextCompat.getColor(this, R.color.pulse_color));

    Bitmap bitmap = Bitmap.createBitmap(d.getIntrinsicWidth()
            , d.getIntrinsicHeight()
            , Bitmap.Config.ARGB_8888);

    // Convert the drawable to bitmap
    Canvas canvas = new Canvas(bitmap);
    d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    d.draw(canvas);

    // Radius of the circle
    final int radius = 100;

    // Add the circle to the map
    circle = mMap.addGroundOverlay(new GroundOverlayOptions()
            .position(latLng, 2 * radius).image(BitmapDescriptorFactory.fromBitmap(bitmap)));
}
 
开发者ID:hypertrack,项目名称:hypertrack-live-android,代码行数:23,代码来源:Home.java

示例2: makeFocusDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@Override
   public Drawable makeFocusDrawable()
{
       GradientDrawable dot_focus = new GradientDrawable();
       dot_focus.setColor(focusColor);
       dot_focus.setCornerRadius(dump.v.Util.dip2px(getContext(), 4));
       dot_focus.setSize(dump.v.Util.dip2px(getContext(), 8), dump.v.Util.dip2px(getContext(), 8));
       return dot_focus;
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:10,代码来源:ColorPointHintView.java

示例3: makeNormalDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@Override
   public Drawable makeNormalDrawable()
{
       GradientDrawable dot_normal = new GradientDrawable();
       dot_normal.setColor(normalColor);
       dot_normal.setCornerRadius(dump.v.Util.dip2px(getContext(), 4));
       dot_normal.setSize(dump.v.Util.dip2px(getContext(), 8), dump.v.Util.dip2px(getContext(), 8));
       return dot_normal;
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:10,代码来源:ColorPointHintView.java

示例4: showExpandedView

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public void showExpandedView(ImageView imageView, PicInfo picInfo) {
    int viewerDW = picInfo.getViewerDW(screenWidth);
    int viewerDH = picInfo.getViewerDH(screenWidth);
    if(viewerDW != 0 && viewerDH != 0){
        GradientDrawable placeholder = (GradientDrawable) m_Activity.getResources().getDrawable(R.drawable.ic_default_placeholder);
        placeholder.setSize(viewerDW, viewerDH);
        GlideUtils.displayImage(m_Activity, imageView, picInfo.getPic_url(), placeholder);
    }else{
        GlideUtils.displayImage(m_Activity, imageView, picInfo.getPic_url(), R.drawable.ic_placeholder_preview);
    }
}
 
开发者ID:Sherchen,项目名称:LikeWechatPhotoViewer,代码行数:12,代码来源:SceneHelp.java

示例5: makeFocusDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@Override
public Drawable makeFocusDrawable() {
    GradientDrawable dot_focus = new GradientDrawable();
    dot_focus.setColor(focusColor);
    dot_focus.setCornerRadius(SizeUtil.dip2px(getContext(), 4));
    dot_focus.setSize(SizeUtil.dip2px(getContext(), 8), SizeUtil.dip2px(getContext(), 8));
    return dot_focus;
}
 
开发者ID:yangchong211,项目名称:YCBanner,代码行数:9,代码来源:ColorPointHintView.java

示例6: makeNormalDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@Override
public Drawable makeNormalDrawable() {
    GradientDrawable dot_normal = new GradientDrawable();
    dot_normal.setColor(normalColor);
    dot_normal.setCornerRadius(SizeUtil.dip2px(getContext(), 4));
    dot_normal.setSize(SizeUtil.dip2px(getContext(), 8), SizeUtil.dip2px(getContext(), 8));
    return dot_normal;
}
 
开发者ID:yangchong211,项目名称:YCBanner,代码行数:9,代码来源:ColorPointHintView.java

示例7: createProductBackground

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@NonNull
private GradientDrawable createProductBackground(Product product) {
    final GradientDrawable gradientDrawable = (GradientDrawable) ContextCompat.getDrawable(
        itemView.getContext(), R.drawable.bg_product);

    gradientDrawable.setColor(ContextCompat.getColor(
        itemView.getContext(), product.color));

    gradientDrawable.setSize(itemView.getWidth(), getDrawableHeight());
    gradientDrawable.mutate();
    return gradientDrawable;
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:13,代码来源:ProductAdapter.java

示例8: getGradientDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public GradientDrawable getGradientDrawable(int strokeWidth,int strokeColor,int fillColor){
    GradientDrawable gd = new GradientDrawable();//创建drawable
    gd.setColor(fillColor);
    gd.setShape(GradientDrawable.OVAL);
    gd.setSize(100, 100);
    gd.setStroke(strokeWidth, strokeColor);
    return gd;
}
 
开发者ID:yaokantv,项目名称:YKCenterDemo-Android,代码行数:9,代码来源:AnimStudy.java

示例9: getIcFolderSelectedDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public static GradientDrawable getIcFolderSelectedDrawable( int color){
    GradientDrawable gradientDrawable=new GradientDrawable();
    gradientDrawable.setShape(GradientDrawable.OVAL);
    gradientDrawable.setSize(SizeUtils.dp2px(24), SizeUtils.dp2px(24));
    gradientDrawable.setBounds(0,0,SizeUtils.dp2px(24), SizeUtils.dp2px(24));
    gradientDrawable.setColor(color);
    return gradientDrawable;
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:9,代码来源:MyDrawable.java

示例10: generateDefaultDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
/**
 * 默认指示器是一系列直径为6dp的小圆点
 */
private GradientDrawable generateDefaultDrawable(int color) {
    GradientDrawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setSize(dp2px(6), dp2px(6));
    gradientDrawable.setCornerRadius(dp2px(6));
    gradientDrawable.setColor(color);
    return gradientDrawable;
}
 
开发者ID:loonggg,项目名称:RecyclerViewBanner,代码行数:11,代码来源:RecyclerViewBanner.java

示例11: addPagerData

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public void addPagerData(PageBean bean, ViewPager viewPager){
    if (bean != null){
        mCount = bean.datas.size();
        if (mCount == 0){
            return;
        }

        mOpenView = bean.openview;
        LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        params.setMargins(mLeftMargin,0,0,0);
        GradientDrawable drawable = new GradientDrawable();
        if (mTransType == TRANS_ROUND) {
            drawable.setShape(GradientDrawable.RECTANGLE);
            drawable.setSize(mTransWidht, mTransHeight);
            drawable.setCornerRadius(mRoundRadius);
        }else{
            drawable.setShape(GradientDrawable.OVAL);
            drawable.setSize(mTransWidht *2, mTransHeight*2);
        }
        drawable.setColor(mDefaultcolor);

        for (int i = 0; i < mCount; i++) {
            ImageView imageView = new ImageView(mContext);
            imageView.setBackground(drawable);
            imageView.setLayoutParams(params);
            if (i == 0){

                mFirstView = imageView;
            }
            if (i == 1){
                mSecondView = imageView;
            }

            addView(imageView);
        }
        if (viewPager != null) {
            viewPager.addOnPageChangeListener(this);
        }
    }
}
 
开发者ID:LillteZheng,项目名称:ViewPagerHelper,代码行数:42,代码来源:TransIndicator.java

示例12: bind

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
void bind(Product product) {
    binding.setProduct(product);

    final GradientDrawable gradientDrawable = (GradientDrawable) ContextCompat.getDrawable(
        itemView.getContext(), R.drawable.bg_product);

    gradientDrawable.setColor(ContextCompat.getColor(
        itemView.getContext(), product.color));

    gradientDrawable.setSize(itemView.getWidth(), getDrawableHeight());

    gradientDrawable.mutate();

    binding.imgProduct.setBackground(gradientDrawable);
    binding.imgProduct.setImageResource(product.image);
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:17,代码来源:ProductViewHolder.java


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