Alternative to setAlpha in api level 8

后端 未结 5 1339
别那么骄傲
别那么骄傲 2021-01-01 17:25

I am working on an app, which can run on Froyo as well as JellyBean. I have a class that extends PageTransformer as below:

import a         


        
5条回答
  •  悲&欢浪女
    2021-01-01 18:29

    so, some resolutions here:


    setAlphaAnimation … API LEVEL 1

    AlphaAnimation alpha = new AlphaAnimation(0.7F, 0.7F);
    alpha.setDuration(0); // Make animation instant
    alpha.setFillAfter(true); // Tell it to persist after the animation ends
    view.startAnimation(alpha);
    

    setAlpha INT -> From API LEVEL 1 -> deprecated in 16

    Drawable background = localLinLayout.getBackground();
    background.setAlpha(180); //255 is max (visible)
    

    setAlpha FLOAT -> API Level 11+ ->


    setImageAlpha -> API LEVEL 16+ (use just for ImageViews)

提交回复
热议问题