android Window background optimization

Source: Internet
Author: User

Views have backgrounds, and each window has a background. Each activity is a window, and each activity has a different background. The drawing order of the interface is as follows: Window--with view--child view. When our view has been covered with the entire window, the program will still draw a transparent window background, which is not visible to the background user. We need to find a way to let the program in this case to remove the window background, save time to draw the window background to improve efficiency.


To delete a window background:


One, in the Java code


public void OnCreate (Bundle icicle) {
Super.oncreate (Icicle);
Setcontentview (R.layout.mainview);
Delete Window background
GetWindow (). setbackgrounddrawable (NULL);
...
}
Second, in the XML file


First, the following is defined in the Res/values/style.xml file:
<resources>
<style name= "Nobackgroundtheme" parent= "Android:theme" >
<item name= "Android:windowbackground" > @null </item>
</style>
</resources>


Then find the activity writing code to remove the background in the Androidmanifest.xml file as follows:
<activity android:name= "MyApplication" android:theme= "@style/nobackgroundtheme" > ... </activity>

android Window background optimization

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.