Android/Tip&Tech
Android: how to create transparent or opeque background
행복한 수지아빠
2011. 12. 22. 14:12
반응형
Android: how to create transparent or opeque background
출처 : http://zaman91.wordpress.com/2010/03/22/android-how-to-create-transparent-or-opeque-background/
You can implement application styles as you like in android platform. If you want to create a transparent background Activity then follow the steps below.
Transparency of background:
- create an activity
- set activity’s theme as “@android:style/Theme.Translucent” in AndroidManifest.xml
- that’s all
If it is needed to have a UI with semi-transparent background, and to define opacity then use this technique withTheme.Translucent. If you set the color of the UI layout as #29000000, the first hex 2-digit(#29) represents alpha channels of color and set opacity. If value is 00 that means 100% transparent. if value is set FF it will be opaque, it can be any value in 00 to FF.
Opaqueness of background / Opacity:
- create an activity
- set activity’s theme as “@android:style/Theme.Translucent” in AndroidManifest.xml
- declare opaque_back a color with setting alpha value such as #29000000(blackish), in …/res/colors.xml
- set activity’s layout background with this color in such as yourlayout.xml <LinearLayout
android:background=”@color/opaque_back”> … </…> - that’s all
Have a nice Android journey.
References:
- http://developer.android.com/guide/topics/ui/themes.html#Properties
- http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/
반응형