将主题在Android的活动? [英] Apply a theme to an activity in Android?

查看:159
本文介绍了将主题在Android的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何将主题应用到整个应用程序,但在那里我会去一个主题应用到只是一个单一的活动?

I know how to apply a theme to a whole application, but where would I go to apply a theme to just a single activity?

推荐答案

您可以将主题通过包括安卓应用到任何活动<活性GT; 里面清单文件

You can apply a theme to any activity by including android:theme inside <activity> inside manifest file.

例如:

  1. &LT;活动机器人:主题=@安卓风格/ Theme.Dialog&GT;
  2. &LT;活动机器人:主题=@风格/ CustomTheme&GT;
  1. <activity android:theme="@android:style/Theme.Dialog">
  2. <activity android:theme="@style/CustomTheme">

如果你想设置主题编程,然后使用 setTheme()之前调用的setContentView()和<$ C $Ç内的onCreate> super.onCreate()办法()方法。

And if you want to set theme programatically then use setTheme() before calling setContentView() and super.onCreate() method inside onCreate() method.

这篇关于将主题在Android的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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