«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

올해는 머신러닝이다.

Android: how to create transparent or opeque background 본문

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:

  1. create an activity
  2. set activity’s theme as “@android:style/Theme.Translucent” in AndroidManifest.xml
  3. 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:

  1. create an activity
  2. set activity’s theme as “@android:style/Theme.Translucent” in AndroidManifest.xml
  3. declare opaque_back a color with setting alpha value such as #29000000(blackish), in …/res/colors.xml
  4. set activity’s layout background with this color in such as yourlayout.xml  <LinearLayout
    android:background=”@color/opaque_back”> … </…>
  5. 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/