Drawable setAlpha - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Drawable setAlpha method.

This code example shows how to use the following methods:draw, setAlpha, setBounds
 
	@Override 
	public void draw(Canvas canvas)
	{ 
		if (background != null) {
			background.setBounds((int) innerRect.left, (int) innerRect.top, (int) innerRect.right, (int) innerRect.bottom);
		} 
 
		canvas.save();
 
		if (background != null) {
			if (alpha > NOT_SET) {
				background.setAlpha(alpha);
			} 
			background.draw(canvas);
		} 
 
		canvas.restore();
	} 
 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:draw, getIntrinsicHeight, getIntrinsicWidth, setAlpha
    public float getPositionY() { 
        return mPositionY;
    } 
 
    public int getWidth() { 
        return mDrawable != null ? mDrawable.getIntrinsicWidth() : 0;
    } 
 
    public int getHeight() { 
        return mDrawable != null ? mDrawable.getIntrinsicHeight() : 0;
    } 
 
    public void draw(Canvas canvas) {
        if (mDrawable == null || !mEnabled) {
            return; 
        } 
        canvas.save(Canvas.MATRIX_SAVE_FLAG);
        canvas.scale(mScaleX, mScaleY, mPositionX, mPositionY);
        canvas.translate(mTranslationX + mPositionX, mTranslationY + mPositionY);
        canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:draw, setAlpha
        } 
        public float getAlpha() { 
            return mAlpha;
        } 
        public void draw(Canvas canvas) {
            mRealDrawable.setAlpha((int) Math.round(mAlpha * 255f));
            mRealDrawable.draw(canvas);
        } 
        @Override 
        public void setAlpha(int alpha) {
            mRealDrawable.setAlpha(alpha);
        } 
        @Override 
        public void setColorFilter(ColorFilter cf) {
            mRealDrawable.setColorFilter(cf);
        } 
        @Override 
        public int getOpacity() { 
            return mRealDrawable.getOpacity();
        } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:draw, setAlpha, setBounds
 
		int alpha = -1;
		if (scrollFade.mStarted) {
			alpha = scrollFade.getAlpha();
			if (alpha < ScrollFade.ALPHA_MAX / 2) {
				mCurrentThumb.setAlpha(alpha * 2);
			} 
			int left = viewWidth - (mThumbW * alpha) / ScrollFade.ALPHA_MAX;
			mCurrentThumb.setBounds(left, 0, viewWidth, mThumbH);
			mChangedBounds = true;
		} 
 
		canvas.translate(0, y);
		mCurrentThumb.draw(canvas);
		canvas.translate(0, -y);
 
		// If user is dragging the scroll bar, draw the alphabet overlay 
		if (mDragging && mDrawOverlay) {
			mOverlayDrawable.draw(canvas);
			final Paint paint = mPaint;
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:ofInt, setAlpha
                ecaView.setAlpha(1f);
            } 
        } 
        if (bouncerFrame != null) {
            if (duration > 0) {
                Animator anim = ObjectAnimator.ofInt(bouncerFrame, "alpha", 255, 0);
                anim.setDuration(duration);
                anim.start();
            } else { 
                bouncerFrame.setAlpha(0);
            } 
        } 
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:draw, getIntrinsicHeight, setAlpha, setBounds
	 * @return true if drawing should continue beyond this frame to continue the animation 
	 */ 
	public boolean draw( Canvas canvas ) {
		update(); 
 
		final int glowHeight = mGlow.getIntrinsicHeight();
		final float distScale = (float) mHeight / mWidth;
 
		mGlow.setAlpha( (int) ( Math.max( 0, Math.min( mGlowAlpha, 1 ) ) * 255 ) );
 
		mGlow.setBounds( 0, 0, mWidth, (int) Math.min( glowHeight * mGlowScaleY * distScale * 0.6f, mHeight * MAX_GLOW_HEIGHT ) );
		mGlow.draw( canvas );
 
		if ( mEdge != null ) {
			final int edgeHeight = mEdge.getIntrinsicHeight();
			mEdge.setAlpha( (int) ( Math.max( 0, Math.min( mEdgeAlpha, 1 ) ) * 255 ) );
			mEdge.setBounds( 0, 0, mWidth, (int) ( edgeHeight * mEdgeScaleY ) );
			mEdge.draw( canvas );
		} 
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAlpha, setBounds
 
    void setIcon(Drawable icon) {
        mIcon = icon;
 
        if (mIcon != null) {
            mIcon.setBounds(sIconBounds);
            mIcon.setAlpha(isEnabled() ? 255 : 99);
        } 
 
        setCompoundDrawables(mIcon, null, mState, null);
    } 
 
    void setIcon(int icon) {
        Drawable drawable = null;
 
        if (icon != 0)
            drawable = getResources().getDrawable(icon);
          
        setIcon(drawable);
    } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:draw, setAlpha
        } 
        public float getAlpha() { 
            return mAlpha;
        } 
        public void draw(Canvas canvas) {
            mRealDrawable.setAlpha((int) Math.round(mAlpha * 255f));
            mRealDrawable.draw(canvas);
        } 
        @Override 
        public void setAlpha(int alpha) {
            mRealDrawable.setAlpha(alpha);
        } 
        @Override 
        public void setColorFilter(ColorFilter cf) {
            mRealDrawable.setColorFilter(cf);
        } 
        @Override 
        public int getOpacity() { 
            return mRealDrawable.getOpacity();
        } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAlpha
    return image.getIntrinsicHeight();
  } 
 
  @Override public void setAlpha(int alpha) {
    if (placeholder != null) {
      placeholder.setAlpha(alpha);
    } 
    image.setAlpha(alpha);
  } 
 
  @Override public void setColorFilter(ColorFilter cf) {
    if (placeholder != null) {
      placeholder.setColorFilter(cf);
    } 
    image.setColorFilter(cf);
  } 
 
  @Override public int getOpacity() { 
    return image.getOpacity();
  } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAlpha, setBackgroundDrawable
                int bgWidth = (int)(((float)b.getHeight()) * ratio);
                 
                b = Bitmap.createBitmap(b, 0, 0,Math.min(b.getWidth(),bgWidth),bgHeight);
                 
                mThemeDrawable = new BitmapDrawable(b);
                mThemeDrawable.setAlpha(200);
            } 
             
             
            activity.getWindow().setBackgroundDrawable(mThemeDrawable);
        } 
         
    } 
     
    @Override 
    protected void onResume() { 
        ((ImApp)this.getApplication()).setAppTheme(this);
        super.onResume(); 
    } 
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Drawable setAlpha Questions & Answers:

Other Drawable setAlpha Examples

23:	
24:			// layout background transparent
25:			llStats.getBackground().setAlpha(150);
26:			llStats.setVisibility(View.VISIBLE);
27:

Read More

setAlpha Method Overview
Specify an alpha value for the drawable.
See Code Examples for other Android Drawable Methods: