How can I make an image transparent on Android?

后端 未结 12 1515
春和景丽
春和景丽 2021-01-30 19:52

I am using a linear layout and frame layout. In the linear layout I keep an image as background and in the frame layout I keep an imageView. In that imageView I give an image.

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 20:25

    On newer versions of Android (post Android 4.2 (Jelly Bean) at least), the setAlpha(int value) method is depreciated. Instead, use the setAlpha(float value) method that takes a float between 0 and 1 where 0 is complete transparency and 1 is no transparency.

提交回复
热议问题