样式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 ...
随机推荐
- ASP.NET RouteModule相关的一些东西
Asp.NET中的路由配置,首先要提到的几个相关类型,Route ,RouteBase,RouteData,RouteTable,RouteCollection 这几个.下面我一次回忆一下,有需要的朋 ...
- C#中的类
C#编程语言,从本质上讲是一组类型声明.所以,本人认为第一个要区分的点是:类型!=类. 当然,如果想要系统的学习C#还是应该先了解一下.Net框架,本文目的只是从相对宏观的角度讲清楚C#中的类.关于类 ...
- python---基本数据类型 dict(字典)
1. 什么是字典 字典是python中唯一的映射类型, 由{ } 括起来的键值对组成,在dict中key是唯一的.字典是以key:value的形式来保存数据, 字典存储数据的时候是用的hash值来存储 ...
- SpringMVC 的映射
27.1.1 @RequestMapping使用 之前,我们是把@RequestMapping注解放在方法之上,用来给方法绑定一个请求映射.除此以外,@RequestMapping注解还可以放在类的上 ...
- Spring框架注解
这四个注解,功能都是一样的,都是用来创建对象的. 但是为什么有这么四个吗?Spring中提供了三个@Component的衍生注解:(功能目前来讲是一样的) @Controller :WEB层 ...
- Python FLask Web 学习笔记:jinjia2的使用方法1
# coding:utf-8 from jinja2 import Template x = """ <p>大爷的孙子</p> <ul> ...
- iOS没你想的那么安全?
iOS应用由于直接运行在用户的手机上,而不是运行在后台服务器上,所以更容易被攻击. 任何系统都会有木马病毒的产生,不存在绝对的安全,iOS应用由于直接运行在用户的手机上,而不是运行在后台服务器上,所以 ...
- django入门-静态文件-part6
尊重作者的劳动,转载请注明作者及原文地址 http://www.cnblogs.com/txwsqk/p/6517553.html 完全翻译自官方文档 https://docs.djangoproje ...
- java使用memcached2--集群部署
一.集群安装 1.编译安装magent-0.5到/usr/local/下 # cd /usr/local # mkdir magent # cd magent/ # wget http://memag ...
- null、 is_null() 、empty() 、isset() PHP 判断变量是否为空
PHP中,在判断变量是否为空的时候,总会纠结应该选用哪个函数,下面列取常用的多种情况,其中1/3经过我的验证,其它来自网络,验证后使用... 使用 PHP 函数对变量 $x 进行比较 表达式 gett ...