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


Java PaintDrawable类代码示例

本文整理汇总了Java中android.graphics.drawable.PaintDrawable的典型用法代码示例。如果您正苦于以下问题:Java PaintDrawable类的具体用法?Java PaintDrawable怎么用?Java PaintDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: drawable

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
public static Drawable drawable(final int[] colorBoxes, final float[] position, final GradientAngle gradientAngle) {
    ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() {
        @Override
        public Shader resize(int width, int height) {
            AngleCoordinate ac = AngleCoordinate.getAngleCoordinate(gradientAngle, width, height);
            LinearGradient linearGradient = new LinearGradient(ac.x1, ac.y1, ac.x2, ac.y2,
                    colorBoxes,
                    position,
                    Shader.TileMode.REPEAT);
            return linearGradient;
        }
    };
    PaintDrawable paint = new PaintDrawable();
    paint.setShape(new RectShape());
    paint.setShaderFactory(shaderFactory);
    return paint;
}
 
开发者ID:akshay2211,项目名称:Ariana,代码行数:18,代码来源:Ariana.java

示例2: ActionBarButtonBackground

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
public ActionBarButtonBackground(int accentHeight, int strokeWidth, Integer strokeColor, Integer accentColor, Integer fillColor, Integer highlightColor, ActionBarOptions.ColorLayout colorLayout) {
	super(new Drawable[] { 
			new PaintDrawable((strokeColor == null) ? DEFAULT_STROKE_COLOR : strokeColor),  
			new PaintDrawable((accentColor == null) ? DEFAULT_ACCENT_COLOR : accentColor), 
			new PaintDrawable((highlightColor == null) ? DEFAULT_HIGHLIGHT_COLOR : highlightColor),
			new PaintDrawable((fillColor == null) ? DEFAULT_FILL_COLOR : fillColor)});
	
	
	if(colorLayout.equals(ColorLayout.TOP)) {
		setLayerInset(1, strokeWidth, strokeWidth, 0, 0);
		setLayerInset(2, strokeWidth, accentHeight+strokeWidth, 0, 0);
		setLayerInset(3, strokeWidth, accentHeight+strokeWidth, 0, strokeWidth);
	}
	else {
		setLayerInset(1, strokeWidth, 0, 0, strokeWidth);
		setLayerInset(2, strokeWidth, 0, 0, accentHeight+strokeWidth);
		setLayerInset(3, strokeWidth, strokeWidth, 0, accentHeight+strokeWidth);
	}
}
 
开发者ID:dylanmaryk,项目名称:InsanityRadio-Android,代码行数:20,代码来源:ActionBarButtonBackground.java

示例3: getActionBarDrawable

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
/**
 * Returns a suitable drawable for ActionBar with theme colors.
 *
 * @param theme        selected theme
 * @param dark         boolean for choosing dark colors or primary colors
 * @param borderBottom bottom border width
 * @return drawable to be used in ActionBar
 */
public static Drawable getActionBarDrawable(Activity activity, int theme, boolean dark, float borderBottom) {
    int[] colors = activity.getResources().getIntArray(theme);

    int color1 = colors[2];
    int color2 = colors[1];

    if (dark) {
        color1 = colors[1];
        color2 = colors[0];
    }

    borderBottom = dipToPx(activity, borderBottom);

    PaintDrawable front = new PaintDrawable(color1);
    PaintDrawable bottom = new PaintDrawable(color2);
    Drawable[] d = {bottom, front};
    LayerDrawable drawable = new LayerDrawable(d);
    drawable.setLayerInset(1, 0, 0, 0, (int) borderBottom);
    return drawable;
}
 
开发者ID:htooaunghlaing,项目名称:NyaungUConverter,代码行数:29,代码来源:FlatUI.java

示例4: makeZoomLabel

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
/**
 * @param context
 * @param zoomController
 */
private void makeZoomLabel(Context context, ZoomButtonsController zoomController) {
	ViewGroup container = zoomController.getContainer();
	View controls = zoomController.getZoomControls();
	LayoutParams p0 = controls.getLayoutParams();
	container.removeView(controls);
	LinearLayout layout = new LinearLayout(context);
	layout.setOrientation(LinearLayout.VERTICAL);
	mZoomLabel = new TextView(context);
	mZoomLabel.setPadding(12, 0, 12, 0);
	mZoomLabel.setTypeface(Typeface.DEFAULT_BOLD);
	mZoomLabel.setTextColor(0xff000000);
	PaintDrawable d = new PaintDrawable(0xeeffffff);
	d.setCornerRadius(6);
	mZoomLabel.setBackgroundDrawable(d);
	mZoomLabel.setTextSize(20);
	mZoomLabel.setGravity(Gravity.CENTER_HORIZONTAL);
	LinearLayout.LayoutParams p1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	p1.gravity = Gravity.CENTER_HORIZONTAL;
	layout.addView(mZoomLabel, p1);
	layout.addView(controls);
	container.addView(layout, p0);
}
 
开发者ID:CRS4-IOT,项目名称:indoorlib,代码行数:27,代码来源:MapScrollView.java

示例5: onClick

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
@Override
public void onClick(final View widget) {
    View view = LayoutInflater.from(context).inflate(R.layout.layout_input, null);
    final EditText etInput = (EditText) view.findViewById(R.id.et_answer);
    Button btnFillBlank = (Button) view.findViewById(R.id.btn_fill_blank);

    // 显示原有答案
    String oldAnswer = answerList.get(position);
    if (!TextUtils.isEmpty(oldAnswer)) {
        etInput.setText(oldAnswer);
        etInput.setSelection(oldAnswer.length());
    }

    final PopupWindow popupWindow = new PopupWindow(view, LayoutParams.MATCH_PARENT, dp2px(40));
    // 获取焦点
    popupWindow.setFocusable(true);
    // 为了防止弹出菜单获取焦点之后,点击Activity的其他组件没有响应
    popupWindow.setBackgroundDrawable(new PaintDrawable());
    // 设置PopupWindow在软键盘的上方
    popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    // 弹出PopupWindow
    popupWindow.showAtLocation(tvContent, Gravity.BOTTOM, 0, 0);

    btnFillBlank.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // 填写答案
            String answer = etInput.getText().toString();
            fillAnswer(answer, position);
            popupWindow.dismiss();
        }
    });

    // 显示软键盘
    InputMethodManager inputMethodManager =
            (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
 
开发者ID:alidili,项目名称:Demos,代码行数:39,代码来源:FillBlankView.java

示例6: SplitPaneLayout

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
/**
 * Basic constructor
 *
 * @param context context
 */
public SplitPaneLayout(final Context context)
{
	super(context);

	this.orientation = SplitPaneLayout.ORIENTATION_HORIZONTAL;
	this.splitterPositionPercent = 0.5f;
	this.splitterPosition = Integer.MIN_VALUE;
	this.splitterDrawable = new PaintDrawable(SPLITTER_COLOR);
	this.splitterDraggingDrawable = new PaintDrawable(SPLITTER_DRAG_COLOR);
}
 
开发者ID:1313ou,项目名称:TreebolicLib,代码行数:16,代码来源:SplitPaneLayout.java

示例7: makeDefaultBackground

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
protected Drawable makeDefaultBackground() {
	PaintDrawable shadow = new PaintDrawable(bottomColor);
	PaintDrawable highlight = new PaintDrawable(topColor);
	PaintDrawable surface = new PaintDrawable(bgColor);
	LayerDrawable layers = new LayerDrawable(new Drawable[] {shadow, highlight, surface});
	
	layers.setLayerInset(0, 0, 0, 0, 0);
	layers.setLayerInset(1, 0, 0, 0, 1);
	layers.setLayerInset(2, 0, 1, 0, 1);
	
	return layers;
}
 
开发者ID:dylanmaryk,项目名称:InsanityRadio-Android,代码行数:13,代码来源:CommentListItemBackgroundFactory.java

示例8: createDrawableFrom

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
private Drawable createDrawableFrom(ShapeDrawable.ShaderFactory sf) {
    PaintDrawable p = new PaintDrawable();
    p.setShape(new RectShape());
    p.setShaderFactory(sf);

    return p;
}
 
开发者ID:alxgrk,项目名称:BlendedBackground,代码行数:8,代码来源:Gradient.java

示例9: onCreate

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.list_draw);
	findViewById(R.id.btn_add).setOnClickListener(this);
	list_menu = (LinearLayout) findViewById(R.id.list_menu);
	list_menu.setVisibility(View.GONE);
	findViewById(R.id.btn_edit).setOnClickListener(this);
	findViewById(R.id.btn_share).setOnClickListener(this);
	findViewById(R.id.btn_setting).setOnClickListener(this);
	findViewById(R.id.btn_check).setOnClickListener(this);
	findViewById(R.id.btn_delete).setOnClickListener(this);
	findViewById(R.id.btn_notemain).setOnClickListener(this);
	
	mTodoList = new ArrayList<DrawNoteList_Row>();
	selectedPosition = -1;
	
	PaintDrawable d = new PaintDrawable(Color.TRANSPARENT);
	getListView().setSelector(d);
	
	//서비스 해제
	AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
	Intent intent = new Intent(DrawNoteList.this, DrawNoteNotification.class);
	PendingIntent pi = PendingIntent.getService(DrawNoteList.this, 0, intent, 0);
	am.cancel(pi);
	NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
	nm.cancelAll();
}
 
开发者ID:yongbeam,项目名称:DiaryMemo,代码行数:29,代码来源:DrawNoteList.java

示例10: getColorScala

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
public PaintDrawable getColorScala() {
    ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() {
        @Override
        public Shader resize(int width, int height) {
            LinearGradient linearGradient = new LinearGradient(width, height, 0, 0,
                    new int[]{
                            getResources().getColor(R.color.altitude_0_100),
                            getResources().getColor(R.color.altitude_100_300),
                            getResources().getColor(R.color.altitude_300_500),
                            getResources().getColor(R.color.altitude_500_1000),
                            getResources().getColor(R.color.altitude_1000_1500),
                            getResources().getColor(R.color.altitude_1500_2000),
                            getResources().getColor(R.color.altitude_2000_2500),
                            getResources().getColor(R.color.altitude_more_than_2500)},
                    new float[]{
                            0, 0.07f, 0.14f, 0.28f, 0.42f, 0.56f, 0.7f, 0.84f},
                    Shader.TileMode.REPEAT);
            return linearGradient;
        }
    };

    PaintDrawable paint = new PaintDrawable();
    paint.setShape(new RectShape());
    paint.setShaderFactory(shaderFactory);

    return paint;
}
 
开发者ID:santiago-hollmann,项目名称:igcparser,代码行数:28,代码来源:FlightPreviewActivity.java

示例11: getBackgroundColorDrawable

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
private static Drawable getBackgroundColorDrawable(int paramInt)
{
  SoftReference localSoftReference = (SoftReference)sBackgroundCache.get(Integer.valueOf(paramInt));
  if ((localSoftReference == null) || (localSoftReference.get() == null))
  {
    localSoftReference = new SoftReference(new PaintDrawable(paramInt));
    sBackgroundCache.put(Integer.valueOf(paramInt), localSoftReference);
  }
  return (Drawable)localSoftReference.get();
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:11,代码来源:ActionBarHelper.java

示例12: setThumbnailMode

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
public void setThumbnailMode(int paramInt)
{
  int i = 1;
  int j;
  if (this.mThumbnailMode != paramInt)
  {
    this.mThumbnailMode = paramInt;
    j = getResources().getColor(2131689753);
    if (this.mThumbnailMode != i) {
      break label77;
    }
    if (i == 0) {
      break label82;
    }
    setBackgroundDrawable(new InsetDrawable(new PaintDrawable(j), 0, this.mThumbnailVerticalPeek, 0, 0));
  }
  for (;;)
  {
    ViewCompat.setPaddingRelative(this, 0, 0, 0, 0);
    requestLayout();
    return;
    label77:
    i = 0;
    break;
    label82:
    setBackgroundColor(j);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:29,代码来源:DetailsSummary.java

示例13: draw

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
public void draw(Canvas paramCanvas)
{
  super.draw(paramCanvas);
  int i = getWidth();
  int j = getHeight();
  if (this.mToDisplayAsDisabled)
  {
    if (this.mDisabledDrawable == null) {
      this.mDisabledDrawable = new PaintDrawable(getResources().getColor(R.color.play_dismissed_overlay));
    }
    this.mDisabledDrawable.setBounds(0, 0, i, j);
    this.mDisabledDrawable.draw(paramCanvas);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:15,代码来源:PlayCardViewBase.java

示例14: init

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
protected void init()
{
    mPaintDrawable = new PaintDrawable();
    mPaintDrawable.setCornerRadius(4);
    mPaintDrawable.setBounds(0, 0, 30, 25);
    setCompoundDrawables(mPaintDrawable, null, null, null);
    
    setText(R.string.colorButtonText);
    
    setOnClickListener(listener);
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:12,代码来源:ColorButton.java

示例15: PaintDrawable

import android.graphics.drawable.PaintDrawable; //导入依赖的package包/类
@TargetApi(16)
private void ˊ()
{
  this.ᐝ = new PaintDrawable();
  this.ᐝ.getPaint().setColor(this.ˊ);
  this.ᐝ.setPadding(this.ˎ, this.ˋ, this.ˎ, this.ˋ);
  this.ᐝ.setCornerRadius(this.ˏ);
  if (Build.VERSION.SDK_INT < 16)
  {
    setBackgroundDrawable(this.ᐝ);
    return;
  }
  setBackground(this.ᐝ);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:15,代码来源:RoundDialogFrame.java


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