[英]Showing dark bar with Theme.Light
I have a problem. 我有个问题。 This is the dialog I get with my code:
这是我收到的代码对话框:
http://es.tinypic.com/r/9acvbl/8 http://es.tinypic.com/r/9acvbl/8
But I want the bar with the title "Modificación" to be white with a blue line below (I think the theme is Theme.Light). 但是我希望标题为“Modificación”的栏为白色,下面带有蓝线(我认为主题是Theme.Light)。
Well, in the Manifest all the activities are: 好吧,在清单中,所有活动是:
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
And for the layout of the dialog, I have selected in the drop-down menu, as you can imagine, Theme.Light. 对于对话框的布局,我已经在下拉菜单中选择了您可以想象的Theme.Light。 I also need to say that I have change manually the styles.xml for API 11+ and API 14+ to:
我还需要说,我已将API 11+和API 14+的styles.xml手动更改为:
<style name="AppBaseTheme" parent="android:Theme.Light">
Why it is showing a dark bar and not the light one? 为什么它显示暗条而不是亮条?
---------SOLVED!!!------------------------------------------- - - - - -解决了!!! - - - - - - - - - - - - - - - - - - - ------
It was as easy (it took me all day long) as change the value in the styles.xml for API 14+ (folder values-v14): 更改API 14+的styles.xml中的值(文件夹值-v14)很容易(花了我整天的时间):
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
It seems that for API 14+ the theme Theme.Light has no effect, so it was taking another theme. 似乎对于API 14+而言,主题Theme.Light无效,因此采用了另一个主题。 If you need it just in a specific activity, you can modify the style for that activity in the Manifest or you can write this code at the beginning of the onCreate of that activity:
如果仅在特定活动中需要它,则可以在清单中修改该活动的样式,或者可以在该活动的onCreate开始时编写以下代码:
int sdkVersion = android.os.Build.VERSION.SDK_INT; // e.g. sdkVersion := 8;
if (sdkVersion >= 14) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
setTheme(android.R.style.Theme_Holo_Light_NoActionBar_Fullscreen);
}
Try this code for dialog, 尝试使用此代码进行对话,
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(
context, android.R.style.Theme.Light));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.