参考资料: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>

最新文章

  1. Node.js-部署【1】-防火墙端口的配置
  2. servlet tomcat servlet debug常见错误404,405,500
  3. Java基础——I/O续
  4. 【WebKit】---WebKit的CSS扩展(WebKit是私有属性)
  5. Hive权限介绍
  6. python描述符descriptor(一)
  7. C++ Primer 5th 第7章 类
  8. Eloquent ORM 学习笔记
  9. ORACLE查看和更改的最大连接数
  10. 通过js获取元素css3的transform rotate旋转角度方法
  11. iOS之copy、strong使用,block特性
  12. C#wxpay和alipay
  13. &lt;HTML&gt;页面与互联网
  14. python 发送163邮件
  15. UVA116-Unidirectional TSP(动态规划基础)
  16. 专注笔试算法20年(C语言版)
  17. python apache下出现The _imaging C module is not installed
  18. dvi 中的内容居中
  19. ZXing.net 生成和解析二维码
  20. Java开发前期准备工作

热门文章

  1. C# 使用 COALESCE 表达式简化 Null 检查
  2. C#集合总结
  3. C#语言各个版本特性(一)
  4. Windows10 下 github ssh 访问出现 Permission denied(publickey)错误的解决方法
  5. 操作XDocument讲解
  6. Python 用队列实现多线程并发
  7. java使用Redis1--安装与简单使用
  8. Jquery、Ajax实现新闻列表页分页功能
  9. set,env和export命令显示shell变量其区别,与环境变量扫盲(一)
  10. 总结day1 ---- 基础内容学习 ,以及历史了解