Android的定制preVIEW窗口 [英] Android Custom Preview Window

查看:161
本文介绍了Android的定制preVIEW窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个应用程序,当我开始启动它,它显示了怪异preVIEW窗口至极是从我正在空空的活动非常diferent ...我想知道如何修改我的主题风格有结果是这样的:
<一href=\"http://cyrilmottier.com/media/2013/01/android-app-launching-made-gorgeaous/launching_contacts.png\"相对=nofollow>谷歌联系人应用程序照片

这是我的风格文件,我的主题俗:

 &LT;?XML版本=1.0编码=UTF-8&GT?;
      &LT;资源的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android&GT;      &LT;样式名称=Theme.InviteToIslam父=@安卓风格/ Theme.Holo.Light.DarkActionBar&GT;
      &LT;项目名称=机器人:actionBarStyle&GT; @风格/ MyActionBar.InviteToIslam&LT; /项目&GT;
     &LT;项目名称=机器人:dropDownListViewStyle&GT; @风格/ DropDownListView&LT; /项目&GT;    &LT; /风格&GT;      &LT;样式名称=MyActionBar.InviteToIslam父=机器人:风格/ Widget.Holo.Light.ActionBar&GT;
&LT;项目名称=机器人:背景&GT; @绘制/ bg_actionbar_pattern&LT; /项目&GT;
  &LT; /风格&GT;      &LT;样式名称=MyTheme的父=@安卓风格/ Theme.Holo.NoActionBar&GT;
      &LT;项目名称=机器人:windowBackground&GT; @色/白&LT; /项目&GT;
      &LT; /风格&GT;
      &LT;样式名称=DropDownListView父=@安卓风格/ Widget.Holo.ListView.DropDown&GT;
      &LT;项目名称=机器人:listSelector&GT; @绘制/ selectable_background_invitetoislam&LT; /项目&GT;
      &LT;项目名称=机器人:背景&GT; @色/白&LT; /项目&GT;
&LT; /风格&GT;    &LT; /资源&GT;


解决方案

您应该按照说明的这里

看起来你已经拥有重写 windowBackground 属性自定义主题,让你一半。

不过,我被你定义了两个主题的事实混淆。他们中的哪一个您使用在您的应用程序的清单您的活动?

我想这是 Theme.InviteToIslam ,这可以解释为什么你windowBackground不会改变,因此为什么你看到一个错误的颜色,而您的活动加载。因此,解决方法很简单,只需移动从 MyTheme的 windowBackground 属性 Theme.InviteToIslam 和删除 MyTheme的,我不认为你会需要它。

I am building an app and when i start launch it, it shows weird preview window wich is very diferent from the activity that i am lauching...I would like to know how to modify my theme style to have a result like this: Google contacts app photo

here is my style file with my custum theme:

      <?xml version="1.0" encoding="utf-8"?>
      <resources xmlns:android="http://schemas.android.com/apk/res/android">

      <style name="Theme.InviteToIslam"      parent="@android:style/Theme.Holo.Light.DarkActionBar">
      <item name="android:actionBarStyle">@style/MyActionBar.InviteToIslam</item>
     <item name="android:dropDownListViewStyle">@style/DropDownListView</item>

    </style>

      <style name="MyActionBar.InviteToIslam" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/bg_actionbar_pattern</item>
  </style>

      <style name="MyTheme" parent="@android:style/Theme.Holo.NoActionBar">
      <item name="android:windowBackground">@color/white</item>
      </style>
      <style name="DropDownListView" parent="@android:style/Widget.Holo.ListView.DropDown">
      <item name="android:listSelector">@drawable/selectable_background_invitetoislam</item>
      <item name="android:background">@color/white</item>
</style>



    </resources>

解决方案

You should follow the instructions here.

Looks like you already have a custom theme with an overriden windowBackground attribute, so you are halfway there.

However, I'm confused by the fact that you define two themes. Which one of them are you using for your activity in your app's manifest?

I guess it's Theme.InviteToIslam, which would explain why your windowBackground is not changed and thus why you see a wrong color while your activity is loading. So the solution is simple, just move the windowBackground attribute from MyThemeto Theme.InviteToIslamand delete MyTheme, I don't think you'll need it.

这篇关于Android的定制preVIEW窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆