[Apidemos for Android samples video series] app-activity-translucent

Source: Internet
Author: User

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 ).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.