android 应用第一次启动的时候,喜欢放一个背景过渡一下,一个为了好看,美观,一个为了去除android自带的黑色背景。
有很多种方法可以做:
1.用一个过渡的Activity,这个activity的背景布局放一张图片
2.我现在使用的方式:使用一个style,设置为第一次启动Activity的style。在android:windowBackground 这个属性设置一个背景图,然后在进入这个activity后,在onCreate() 中马上手动的设置这个背景图为null,防止重新绘制,占用内存。我觉得这种方式相当好,当时为了研究这个用了几天的时间,最后在google的官方博客看到他们推荐使用这种方式,链接见下面。
<resources> <style name="Theme.Shelves" parent="android:Theme"> <item