Android 主题(Theme)实现
16lz
2021-01-23
主要代码如下
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 的C++代码都加 namespace android
- Android代码混淆一定要Export Android Application,否则不起效
- Android的Location功能代码
- 第一行代码笔记之——Activity启动模式
- Android:简单联网获取网页代码
- Android 开发笔记 - Android Studio 代码模板
- android源代码下载及编译
- android 用代码画圆