1. Demo description and demonstration
This demo shows a translucent activity, mainly implemented through style and theme.
As follows:
2. Video description
Http://www.eyeandroid.com/thread-10936-1-1.html
3. Demo Analysis
The last few examples of activity classification examples are used to display translucent activity. The examples are similar. The translucent effect of the activity is mainly achieved through style and theme.
Let's take a look at the definition of translucentactivity in androidmanifest. xml:
<Activity Android: Name = ". App. translucentactivity"
Android: Label = "@ string/activity_translucent"
Android: theme = "@ style/theme. translucent">
<Intent-filter>
<Action Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. sample_code"/>
</Intent-filter>
</Activity>
It uses the theme. translucent topic, which is defined in RES/styles. xml
<! -A theme that has a translucent background. Here we explicitly specify
That this theme is to inherit from the system's translucent theme,
Which sets up various attributes correctly.->
<Style name = "theme. translucent" parent = "Android: style/theme. translucent">
<Item name = "Android: windowbackground"> @ drawable/translucent_background </item>
<Item name = "Android: windownotitle"> true </item>
<Item name = "Android: colorforeground"> # fff </item>
</Style>
It inherits the system theme Android: style/theme. translucent and then modifies it. @ Drawable/translucent_background is defined in colors. xml. The color value is # e0000000, And the Alpha value is # E0 (translucent ).