Android-Optimizing UI Performance (3)-Optimize your activity's background image

Source: Internet
Author: User

android-Optimizing UI Performance (3)-Optimize your activity's background image
At some point, we may want to improve the performance of the activity as much as possible, then we can optimize the activity's background graph
First, in the activity, not only the view that you use for the Setcontentview (), but also some other view
Such as:


By default, Decorview contains a default background map, which is the starting point to optimize activity
1, using
GetWindow (). setbackgrounddrawable (drawable)
GetWindow (). Setbackgrounddrawableresource (Resid)
The code is as follows:

@Override    protectedvoidonCreate(Bundle savedInstanceState)    {        super.onCreate(savedInstanceState);        getWindow().setBackgroundDrawableResource(R.drawable.ic_launcher);        setContentView(R.layout.activity_main);    }

2, custom theme
Create a Res/values/theme.xml file
The format is defined as follows:

<resource>    <style name="Mytheme" parent="android:Theme">     <item name="android:windowBackground">@null</item>    </style></resources>

You can set the mytheme to NULL as needed or the background image you need

Then add it in the OR tag

android:theme="@style/MyTheme"

Copyright NOTICE: Welcome to communicate the error of the article, must humbly accept, QQ872785786

Android-Optimizing UI Performance (3)-Optimize your activity's background image

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.