Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ImageView
- android:src="@drawable/logosmall"
- android:adjustViewBounds="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/imageLogo"/>
- <com.mydomainhere.customImageView
- android:src="@drawable/logosmall"
- android:adjustViewBounds="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/imageLogo"/>
- public class customImageView extends ImageView{
- private float mAlpha = 5f;
- private float mDelta = 1f;
- public customImageView(Context context) {
- super(context);
- }
- public customImageView(Context context, AttributeSet attrs) {
- super(context);
- this.setAlpha((int)mAlpha);
- }
- @Override
- public void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- if (mAlpha > 254){
- mDelta = -1f;
- }
- if (mAlpha < 1){
- mDelta = 1f;
- }
- mAlpha = mAlpha + mDelta;
- this.setAlpha((int)mAlpha);
- this.invalidate();
- }
- }
Add Comment
Please, Sign In to add comment