修改加载Activity 的view之前的window界面
来源:互联网 发布:jsp javascript 编辑:程序博客网 时间:2024/06/04 23:35
当你设置你的UI在activity上时 by calling setContentView() ,android增加你的VIEW在activity的WINDOW上。
这个窗口并不只包含你的VIEW。
DecorView
LinearLayout
FrameLayout FrameLayout
TextView FrameLayout
.. ....
DecorView实际上hold这window的背景drawble.可以通过getWindow().setBackgroundDrawable()
从activity中改变windows的背景图。如果你用默认的android theme,一个默认的背景drawable将被设置到你的activity上。
这个drawable目前是一个ColorDrawable(好像是灰黑色的)。对于大多数application,这个背景图能工作很好可以被保留。
但是能影响点性能。
如果你在你的activity上设置一个不透明的背景图,那么在你后面的DecorView的背景图也就是默认窗口的背景图就不可见了,那么
画他就没意义了。
删除这个背景很容易:This drawable is simply referenced by the theme:
<resources>
<style name="Theme.Shelves" parent="android:Theme">
<item name="android:windowBackground">@drawable/background_shelf</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
android:theme="@style/Theme.NoBackground"
to your
<activity />
or <application />
tag
这个技巧很好的对于用MapView
, a WebView
or any other full screen opaque
view.
用一个theme去改变windows的背景也是个很好的办法能给改善启动activity的性能。
如果你的application简单的设置背景在XML layout里或者在ONCREATE里,用户将能看到application启动时带着默认的theme和
他的黑背景。你设置的背景只是appear after the inflation of the content view and the first layout/drawing
pass.
以下是设置背景(窗口背景,不是activity背景,如果你设置了窗口背景,那么activity就不用设置了)
in res/drawable/background_shelf.xml
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/shelf_panel"
android:tileMode="repeat" />This drawable is simply referenced by the theme:
<resources>
<style name="Theme.Shelves" parent="android:Theme">
<item name="android:windowBackground">@drawable/background_shelf</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
这个窗口并不只包含你的VIEW。
DecorView
LinearLayout
FrameLayout FrameLayout
TextView FrameLayout
.. ....
DecorView实际上hold这window的背景drawble.可以通过getWindow().setBackgroundDrawable()
从activity中改变windows的背景图。如果你用默认的android theme,一个默认的背景drawable将被设置到你的activity上。
这个drawable目前是一个ColorDrawable(好像是灰黑色的)。对于大多数application,这个背景图能工作很好可以被保留。
但是能影响点性能。
如果你在你的activity上设置一个不透明的背景图,那么在你后面的DecorView的背景图也就是默认窗口的背景图就不可见了,那么
画他就没意义了。
删除这个背景很容易:This drawable is simply referenced by the theme:
<resources>
<style name="Theme.Shelves" parent="android:Theme">
<item name="android:windowBackground">@drawable/background_shelf</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
android:theme="@style/Theme.NoBackground"
to your
<activity />
or <application />
tag
这个技巧很好的对于用MapView
, a WebView
or any other full screen opaque
view.
用一个theme去改变windows的背景也是个很好的办法能给改善启动activity的性能。
如果你的application简单的设置背景在XML layout里或者在ONCREATE里,用户将能看到application启动时带着默认的theme和
他的黑背景。你设置的背景只是appear after the inflation of the content view and the first layout/drawing
pass.
以下是设置背景(窗口背景,不是activity背景,如果你设置了窗口背景,那么activity就不用设置了)
in res/drawable/background_shelf.xml
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/shelf_panel"
android:tileMode="repeat" />This drawable is simply referenced by the theme:
<resources>
<style name="Theme.Shelves" parent="android:Theme">
<item name="android:windowBackground">@drawable/background_shelf</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
- 修改加载Activity 的view之前的window界面
- 动态加载Layout 与 论Activity、 Window、View的关系
- Activity Window View的关系
- Activity,Window,View的关系
- Activity、Window、View的关系
- Activity、Window、View的关系
- Activity、Window、View的关系
- Activity、Window、View的关系
- Activity、Window、View的关系
- Activity、Window、View的关系
- Activity、View、Window的理解
- Activity、View、Window的理解
- 为什么修改android启动的activity,第一次启动时还是之前的界面?
- ViewPager的多个view界面 activity的动态加载和xml静态加载
- activity 和 window view 的关系
- Android中window,view,Activity的关系
- Android杂谈--Activity、Window、View的关系
- Activity Window View 之间的关系
- android 4.0 拦截Home
- Android4.0.4编程日记(2)--ListView
- SQL Server索引进阶第六篇:书签
- 七律送同事兼《解放战争》读后
- 设计模式 经典书籍必备推荐
- 修改加载Activity 的view之前的window界面
- MFC 自定义数字控件 (继承自CEdit)
- LibSVM学习(四)——逐步深入LibSVM
- GEF中鼠标双击事件的获取
- HTTP协议详解
- SQL Server索引进阶第七篇:过滤的索引
- 中国 省级 单位 的 字母 简称 和 字母 排列 顺序
- 【Android】保存Activity的状态
- eclipse+spket+extjs4.1开发环境搭建和代码智能提示