zoukankan      html  css  js  c++  java
  • 我的Android最佳实践之—— 解决闪空界面问题

    进入应用时,由于应用的启动Activity都会有默认的theme,所以会跳一下原始界面,才启动我们定义的theme。

    修改这个问题的方法,就是给应用启动的Activity设置一个空的theme。如下面的例子:

    联系人启动时的Activity为PeopleActivity ,我们就在manifest文件中设置PeopleActivity 的theme为一个空的theme

            <activity android:name=".activities.PeopleActivity"

                android:label="@string/people"

                android:theme="@style/GnEmptyTheme"

                android:uiOptions="splitActionBarWhenNarrow"

                android:clearTaskOnLaunch="true"

                android:launchMode="singleTask"

                android:windowSoftInputMode="adjustPan"

                android:configChanges="orientation"

             >

    GnEmptyTheme 就是一个空的theme,里面什么内容页没有,在styles.xml中如下定义:

        <style name="GnEmptyTheme">

        </style>

    要实现白色主题、黑色主题或者透明主题,就在此Activity的onCreate方法中,使用setTheme设置对应主题即可。

    注意setTheme要在super.onCreate(savedInstanceState)之前;

  • 相关阅读:
    【leetcode】Valid Palindrome
    【leetcode】Longest Common Prefix
    【leetcode】Intersection of Two Linked Lists
    【leetcode】Compare Version Numbers
    【leetcode】Pascal's Triangle
    ubuntu 14.04下spark简易安装
    【leetcode】Number of 1 Bits
    【leetcode】LRU Cache
    【leetcode】Container With Most Water
    【leetcode】Roman to Integer
  • 原文地址:https://www.cnblogs.com/scarecrow-blog/p/5763094.html
Copyright © 2011-2022 走看看