Android 主题(Theme)实现
来源:互联网 发布:windows旗舰版密钥 编辑:程序博客网 时间:2024/04/30 13:50
主要代码如下
1)设置Theme(res/values/styles)
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --> <style name="AppBaseTheme" parent="android:Theme.Light"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> <!-- blue --> <style name="blueTheme"> <item name="android:background">@color/blue</item> <item name="android:textColor">@color/white</item> </style> <!-- black --> <style name="blackTheme"> <item name="android:background">@color/black</item> <item name="android:textColor">@color/white</item> </style></resources>
2)调用样式
package com.example.androidtestapp;import android.os.Bundle;import android.app.Activity;import android.view.Menu;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);/*bluesetTheme(R.style.blueTheme);*//*black*/setTheme(R.style.blackTheme);setContentView(R.layout.activity_main);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true;}}
- Android 主题(Theme)实现
- android主题(theme)
- Android:主题(Theme)
- Android 主题(Theme)的实现
- Android theme应用主题实现
- Android 使用主题(Theme)
- Android 使用主题(Theme)
- Android主题切换(Theme)实现日夜间功能
- Android主题切换(Theme)实现日夜间功能
- android 自带主题样式(theme )
- Android style(样式), theme(主题)资源
- android中的主题Theme
- android中的主题Theme
- Android笔记 theme主题
- Android主题Theme
- android 的主题theme
- Android中的主题(Theme)
- Android-Theme 主题
- linux c语言字符串函数replace,indexOf,substring等的实现
- jQuery 获取屏幕高度、宽度
- Asp.Net直接退出系统的代码!(转)
- Eclipse插件links安装
- C#访问远程主机资源的方法
- Android 主题(Theme)实现
- 写于梦开始之前
- CMMI3过级2
- jquery 实现checkbox全选,反选,全不选等功能代码(奇数)
- 纠结的GTD之路——一个GTD初学者的心路历程
- Grails技巧系列——GORM中select结果进行count的方法
- ASP.NET表单验证方法详解
- [4月26日的脚本] 在Office 365 Exchange Online中为大邮件获取邮箱文件夹统计信息
- ACM算法相关资料