样式styles和主题theme
参考资料:http://blog.csdn.net/sshhbb/article/details/7219838/
/values/styles.xml
<resources> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> //这个是主题,继承与DarkActionBar
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="buttonstyle"> //这个为自己添加的
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:text">heihei</item>
</style> </resources>
/layout/Activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="sample.android_serialport_api.myapplication.MainActivity">
...
<Button
style="@style/buttonstyle" //在这里使用的style
android:id="@+id/butto6"/>
<Button
style="@style/buttonstyle"
android:id="@+id/butto7"/>
<Button
style="@style/buttonstyle"
android:id="@+id/butto8"/>
</LinearLayout>
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sample.android_serialport_api.myapplication"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"> //在这里使用的主题
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>
样式styles和主题theme的更多相关文章
- 第十四章:样式(Style)和主题(Theme)
简介 Android的样式(Style)和主题(Theme)文件就好比WEB开发中的CSS一样,可以实现UI界面的风格统一管理,这和Windows平台的XAML格式(Silverlight.WPF)类 ...
- Android 自定义属性(attrs)、样式(Style)、主题(Theme)
Android 自定义属性(attrs).样式(Style).主题(Theme) https://www.cnblogs.com/dandre/p/4507024.html https://blog. ...
- Android 样式 (style) 和主题(theme)
转载:https://gold.xitu.io/post/58441c48c59e0d0056a30bc2 样式和主题 样式是指为 View 或窗口指定外观和格式的属性集合.样式可以指定高度.填充.字 ...
- Android样式(style)和主题(theme)
样式和主题 样式是指为 View 或窗口指定外观和格式的属性集合.样式可以指定高度.填充.字体颜色.字号.背景色等许多属性. 样式是在与指定布局的 XML 不同的 XML 资源中进行定义. Andro ...
- 20.(转)Android的样式(Style)和主题(Theme)
Android上的Style分为了两个方面: 1,Theme是针对窗体级别的,改变窗体样式: 2,Style是针对窗体元素级别的,改变指定控件或者Layout的样式. Android系统的themes ...
- android的样式(style)与主题(theme)
Android上的Style分为了两个方面: 1,Theme是针对窗体级别的,改变窗体样式: 2,Style是针对窗体元素级别的,改变指定控件或者Layout的样式. Android系统的themes ...
- 安卓样式Style和主题Theme
1. 区别 不过style是针对view来说的,比如TextView和EditText这些:而Theme必须针对整个activity或者整个application 2. 样式 创建一个样式,根元素 & ...
- Android下Notification,样式style,主题theme的功能实现
一:Notification 1.NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVIC ...
- 总结一下Android中主题(Theme)的正确玩法
在AndroidManifest.xml文件中有<application android:theme="@style/AppTheme">,其中的@style/AppT ...
随机推荐
- Angular4 配置问题
出现错误: Local workspace file ('angular.json') could not be found.Error: Local workspace file ('angular ...
- 自己从0开始学习Unity的笔记 II (C#条件语句基础练习)
首先,自己用了下三目表达式,来做了一个闰年的判断,也就是能被400整除,或者是能够被4整除,但是不能被100整除的年份. int year; //输入的年 bool fourHunderd; //能被 ...
- leetcode 验证回文串
给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写. 说明:本题中,我们将空字符串定义为有效的回文串. 示例 1: 输入: "A man, a plan, a c ...
- BitAdminCore框架更新日志20180524
20180524更新内容 本次更新两个内容,一是增加windows service,二是增加邮件发送功能. windows service windows service用于定期跑服务,网上有一些提供 ...
- webapi中session为null的解决方案
Session webapi中session为null的解决方案 在Global.asax里添加:开启Session功能(默认是不开启) 重写init方法 public class WebApiAp ...
- MyBatis入门程序(基于XML配置)
创建一个简单的MyBatis入门程序,实现对学生信息的增删改查功能(基于XML配置) 一.新建一个Java工程,导入MyBatis核心jar包.日志相关的jar包以及连接Oracle数据库所需驱动包, ...
- 【timeisprecious】【JavaScript 】JavaScript RegExp 对象
JavaScript>RegExp正则表达式 1 .From Runnob JavaScript RegExp 对象(概览) JavaScript RegExp 对象(教程) RegExp 对象 ...
- npm 查看express版本
npm list 名称 eg: npm list express
- npm start时报错 npm ERR!Windows_NT 6.1.7601
练习webpack 时 输入 npm start就报这样的错.百度了一圈,都没有找到答案.于是,我开始看错误信息......................................../手动黑 ...
- C++实现二叉树的相应操作
1. 二叉树的遍历:先序(递归.非递归),中序(递归.非递归),后序(递归.非递归). #include <iostream> #include <string> #inclu ...