안드로이드 액티비티 반투명하게 하기

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
layoutParams.dimAmount = 0.8f; // 투명도 0 ~ 1
getWindow().setAttributes(layoutParams);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND; layoutParams.dimAmount = 0.8f; // 투명도 0 ~ 1 getWindow().setAttributes(layoutParams);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
layoutParams.dimAmount = 0.8f; // 투명도 0 ~ 1
getWindow().setAttributes(layoutParams);

위 내용은 onCreate에 넣어주고

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
android:theme="@android:style/Theme.Translucent"
android:theme="@android:style/Theme.Translucent"
android:theme="@android:style/Theme.Translucent"  

이건 AndroidManifest.xml 에서 해당 액티비티에 아래 속성을 넣어준다


Comments

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다