本文整理汇总了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)));
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}