Android(安卓)主题(Theme)实现
16lz
2021-12-04
主要代码如下
1)设置Theme(res/values/styles)
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 版本
- android销毁Activity和被系统销毁时的数据保存
- android JNI cocos2dx调用对话框
- 2013.06.26——— android 关于Scroller
- [置顶] 调用Android发短信接口Intent.ACTION_SENDTO
- 对View DrawingCache的理解
- android 调用call
- [Innost]Android深入浅出之Binder机制
- Android(安卓)Studio 使用Gradle在Terminal终端用命令打包