在xml 设置的效果

和setTheme的效果不一样

android:windowBackground

没有效果????????

代码如下:

  super.onCreate(savedInstanceState);        setTheme(R.style.blueSummerTheme);        setContentView(R.layout.main);



解决方案!!

有效果的代码!

setTheme(R.style.blueSummerTheme);        super.onCreate(savedInstanceState);                setContentView(R.layout.main);



内部原理的分析:

主题设置要先获取相关属性的设置,在进行绘制在界面上!


from 下面这句话便可以得出这样的结论!

public void setTheme(int resid)

Since: API Level 1

Set the base theme for this context. Note that this should be called before any views are instantiated in the Context (for example before calling setContentView(View) or inflate(int, ViewGroup)).

Parameters
resid The style resource describing the theme.

上面的android:windowBackground没有效果,是因为它的属性的获取是在

  super.onCreate(savedInstanceState);

故要 把它放在 setTheme的后面便会有效果!



呵呵!下班了!


更多相关文章

  1. android 源码大全
  2. Android加载网络图片
  3. Android(安卓)Intent Flag组合使用
  4. Android(安卓)Studio 配置多个代码仓库(maven)
  5. android -------- ConstraintLayout 宽高比和偏移量比(三)
  6. android设置wallpaper
  7. Android(安卓)CollapsingToolbarLayout:将ActionBar载入Toolbar(2)
  8. Android(安卓)为Notification加上一个进度条
  9. 第一篇 GridView控件

随机推荐

  1. Android自定义View底部连续圆环效果
  2. Android中RecyclerView的item中控件的点
  3. Android Studio精彩案例(五)《JSMS短信验
  4. Android模拟器调试html5 app
  5. Android studio 升级2.2 之后 Maven插件
  6. [置顶] Android Studio、eclipse
  7. Android特效专辑(十二)——仿支付宝咻一咻
  8. EventBus的使用,注意事项,错误分析
  9. AIDL详解2——复杂数据通信
  10. 自定义快速滚动条FastScrollBar