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