當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。