关于android 4.2的默认Theme,如何修改? 在 framework 中的那个 themes.xml 还有那个 styles.xml 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 theme里面有很多中 我要的是系统默认的那种! 默认的就是framework下的那个themes.xmltheme是默认的,其他的都是类似继承了theme的,可供选择的当然应用也可以自己定义的 在 menifest.xml 文件中你可以设置默认的主题:<applicationandroid:theme="@android:style/Theme.Black"/>你肯定是设置的android:theme="resource or theme"属性。请参考:http://developer.android.com/guide/topics/manifest/application-element.html framework下的那个themes.xml 里面 第一个 <style name="Theme">这个就是默认的。在ContextImpl.java文件getTheme()里可以看到 if(mThemeResource == 0) { mThemeResource = com.android.internal.R.style.Theme; }应该是如果theme没有设置过,就给一个默认theme id。 在PhoneWindowManager.java里也有设置默认theme的地方,也是同一个id;所以我觉得可以改一下<style name="Theme">的内容,或者把这个默认id换成com.android.internal.R.style.Theme_Light。不过Theme.Light比Theme少了很多内容,不知道直接换id会不会出问题。先说明,我只是看代码分析的,没试过,谁试试? 你看的是什么版本的代码?我这边看的是4.2的代码,已经没有你那个判断条件了,getTheme()方法内直接掉到Resource里面的selectDefaultTheme()方法里面,但是我改了哪些里面有几个theme ,我把它全部改成theme.holo.light,长按Power键出来的框还是黑底白字! 不过如果不设置theme,一个application会是theme.holo.light 你看的是什么版本的代码?我这边看的是4.2的代码,已经没有你那个判断条件了,getTheme()方法内直接掉到Resource里面的selectDefaultTheme()方法里面,但是我改了哪些里面有几个theme ,我把它全部改成theme.holo.light,长按Power键出来的框还是黑底白字!请问楼主解决了没阿? 在android 4.2上是在ActivityManagerService.java里面的main函数public static final Context main(int factoryTest) { AThread thr = new AThread(); thr.start(); mEnableAppLaunchLog = checkAppLaunchLogTimeSetting(); /// M: It's for debugging App Launch time synchronized (thr) { while (thr.mService == null) { try { thr.wait(); } catch (InterruptedException e) { } } } ActivityManagerService m = thr.mService; mSelf = m; ActivityThread at = ActivityThread.systemMain(); mSystemThread = at; Context context = at.getSystemContext(); context.setTheme(android.R.style.Theme_Holo_Light); Log.d("richard", "theme ... or what"); m.mContext = context; m.mFactoryTest = factoryTest; m.mMainStack = new ActivityStack(m, context, true); m.mBatteryStatsService.publish(context); m.mUsageStatsService.publish(context); synchronized (thr) { thr.mReady = true; thr.notifyAll(); } m.startRunning(null, null, null, null); /// M: ANRManager Mechanism @{ m.mANRManager = new ANRManager(m); m.mANRManager.startANRManager(); m.mAnrDumpMgr = m.mANRManager.mAnrDumpMgr; m.mAnrHandler = m.mANRManager.mAnrHandler; /// @} return context; } 修改这个主题就OK了context.setTheme(android.R.style.Theme_Holo_Light);默认是Theme_Holo ActivityThread里面有一个performLaunchActivity函数,这里会设置应用的默认主题,如果应用中有设置就用应用里面的,如果没有就用系统默认的。ActivityManagerService里面设置主题是给系统用的。PhoneWindowManager里面设置主题是给应用启动窗口用的。 大家帮忙看一段Log 在Activity自定义View内部类出现错误,求解! 急:android动画 如何绕Y轴旋转,求代码 ViewFlipper多个View时,下面有多个点,表示当前激活的View 如何查看android的Bluetooth所有可用的profile Android中获取TD网络的P-CCPCH RSCP(场强),急,在线等! android seekbar滑块刷新问题 TextView如何显示带<image>标签的文本? 本人新手,求书介绍。 怎么在eclipse中导入安卓源码 android'火焰.烟雾传感器数据接收处理 android nfc 打开文件
theme是默认的,其他的都是类似继承了theme的,可供选择的
当然应用也可以自己定义的
<application
android:theme="@android:style/Theme.Black"
/>
你肯定是设置的android:theme="resource or theme"属性。请参考:http://developer.android.com/guide/topics/manifest/application-element.html
在ContextImpl.java文件getTheme()里可以看到
if(mThemeResource == 0) {
mThemeResource = com.android.internal.R.style.Theme;
}
应该是如果theme没有设置过,就给一个默认theme id。
在PhoneWindowManager.java里也有设置默认theme的地方,也是同一个id;所以我觉得可以改一下<style name="Theme">的内容,或者把这个默认id换成com.android.internal.R.style.Theme_Light。不过Theme.Light比Theme少了很多内容,不知道直接换id会不会出问题。先说明,我只是看代码分析的,没试过,谁试试?
请问楼主解决了没阿?
AThread thr = new AThread();
thr.start(); mEnableAppLaunchLog = checkAppLaunchLogTimeSetting(); /// M: It's for debugging App Launch time synchronized (thr) {
while (thr.mService == null) {
try {
thr.wait();
} catch (InterruptedException e) {
}
}
} ActivityManagerService m = thr.mService;
mSelf = m;
ActivityThread at = ActivityThread.systemMain();
mSystemThread = at;
Context context = at.getSystemContext();
context.setTheme(android.R.style.Theme_Holo_Light);
Log.d("richard", "theme ... or what");
m.mContext = context;
m.mFactoryTest = factoryTest;
m.mMainStack = new ActivityStack(m, context, true);
m.mBatteryStatsService.publish(context);
m.mUsageStatsService.publish(context);
synchronized (thr) {
thr.mReady = true;
thr.notifyAll();
} m.startRunning(null, null, null, null);
/// M: ANRManager Mechanism @{
m.mANRManager = new ANRManager(m);
m.mANRManager.startANRManager();
m.mAnrDumpMgr = m.mANRManager.mAnrDumpMgr;
m.mAnrHandler = m.mANRManager.mAnrHandler;
/// @}
return context;
}
ActivityManagerService里面设置主题是给系统用的。
PhoneWindowManager里面设置主题是给应用启动窗口用的。