1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Android】背景色を透過する方法(備忘録)

Posted at

プログラミング勉強日記

2021年1月12日
Android Studioで開発をしているときに、背景の色を透過することにてこずったのでその方法を備忘録として記録する。

背景色を透過する方法

CSSではtransparentやrgbaで指定する。Androidでのレイアウトでの背景色透過の方法をまとめる。

1. 8桁の色指定で設定する方法

 8桁での色指定では上位2桁が不透明度で、最初の6桁がRGBの指定である。上位2桁の不透明度は、00(透明)~FF(不透明)の相対値で指定する。
 

android:background="#00000000"

2. Viewのalpha属性で指定する方法

 alpha属性に少数で指定する。Alpha値は0.00(透明)~1.00(不透明)の範囲で相対的に設定できる。

android:alpha="0.25"
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?