简单练习自定义样式和主题,样式是加在View上,主题是加在Application或者Activity上

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 自定义样式 -->
<style name="MyFont">
<item name="android:textColor">#ff0000</item>
<item name="android:textSize">40sp</item>
</style>
<style name="MyFontSon" parent="@style/MyFont">
<item name="android:textSize">30sp</item>
</style>
<!-- 自定义主题 -->
<style name="MyTheme">
<item name='android:windowNoTitle'>true</item>
<item name="android:background">#ffffff</item>
</style>
</resources>

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <TextView
style="@style/MyFont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="样式和主题"
/>
<TextView
style="@style/MyFontSon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="样式和主题"
/>
</LinearLayout>

Manifest.xml

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="ss"
android:theme="@style/MyTheme" >

[android] 安卓自定义样式和主题的更多相关文章

  1. Android RatingBar 自定义样式

    Android RatingBar 自定义样式 1.先定义Style: <style name="RadingStyle" parent="@android:sty ...

  2. xamarin android checkbox自定义样式

    xamarin android checkbox自定义样式 在drawable文件在新建checkbox_bg.xml文件 <?xml version="1.0" encod ...

  3. android中的样式和主题

    有的时候我们一个页面要用很多个textview,而且这些textview的样式非常相像,这种情况下我们可以把这些样式抽取出来,然后在每个textview中引用即可,这样修改起来也方便. 我们来看一个简 ...

  4. Android中自定义样式与View的构造函数中的第三个参数defStyle的意义

    零.序 一.自定义Style 二.在XML中为属性声明属性值 1. 在layout中定义属性 2. 设置Style 3. 通过Theme指定 三.在运行时获取属性值 1. View的第三个构造函数的第 ...

  5. Android下Notification,样式style,主题theme的功能实现

    一:Notification 1.NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVIC ...

  6. Android EditText自定义样式

    第一步:为了更好的比较,准备两个一模一样的EditText(当Activity启动时,焦点会在第一个EditText上,如果你不希望这样只需要写一个高度和宽带为0的EditText即可避免,这里就不这 ...

  7. android中的样式主题和国际化

    一.Android中的样式和主题     1.1样式     样式是作用在控件上的,它是一个包含一个或者多个view控件属性的集合.android style类似网页设计中的css设计思路,可以让设计 ...

  8. Android指南 - 样式和主题

    本文翻译自:https://developer.android.com/guide/topics/ui/themes.html Style和theme词汇是专用术语,下文直接使用而不翻译. 样式和主题 ...

  9. 安卓—自定义 AlertDialog 的样式

    自定义修改安卓弹出框的样式 效果图: 1.在style.xml下添加 <!-- 自定义弹出样式 --> <style name="MyDialogStyle" p ...

随机推荐

  1. Mysql 索引原理《一》索引原理与慢查询2

    一 索引未命中 并不是说我们创建了索引就一定会加快查询速度,若想利用索引达到预想的提高查询速度的效果,我们在添加索引时,必须遵循以下问题 1 范围问题,或者说条件不明确,条件中出现这些符号或关键字:& ...

  2. StratifiedShuffleSplit()函数 实现对数据集的划分

    sklearn.model_selection.StratifiedShuffleSplit(n_splits=10, test_size=’default’, train_size=None, ra ...

  3. UItextInput-Protocol

    UItextInput是一个protocol,一般来说,文字处理的控件都要遵守这个协议.如UITextField,UITextView.下面介绍一些文字处理的基本概念. marked text 对于多 ...

  4. 【关于selenium自动化中,Webdriver的原理以及工作流程】

    原文地址:https://www.cnblogs.com/imyalost/p/7242747.html#4109245 作者:老 张 1.关于Webdriver 设计模式:按照Server-Clie ...

  5. 2018年10月19 手记 - 身为开发者的我de窘境

    从10月1国庆过完节回来,那已经是7号了,之后便开始紧锣密鼓的筹划着接下来11月份的公司组织的对外活动,这边新来的产品对产品或者说对任务很是负责,并且策划了很多的方案,并且乐意站在我们开发的角度上去考 ...

  6. Eclipse Alt + / 快捷键失效

    需要重新设置快捷键.按快捷键ctrl+shirt+L,然后在按一下L.设置快捷键的对话框就出来了,然你将Word Completion移除,在将Content Assist 这个设置为alt+/.就可 ...

  7. CF1063F. String Journey(后缀数组+线段树)

    题目链接 https://codeforces.com/contest/1063/problem/F 题解 虽然本题有时间复杂度较高但非常好写的做法...... 首先,若答案为 \(k\),则一定存在 ...

  8. 用Laya制作简单的动画

    (function () { var layaGameInit = window.layaGameInit || {}; var WebGL = Laya.WebGL; var Browser = L ...

  9. Codeforces - 规律题 [占坑]

    发现自己容易被卡水题,需要强行苟一下规律题 CF上并没有对应的tag,所以本题集大部分对应百毒搜索按顺序刷 本题集侧重于找规律的过程(不然做这些垃圾题有什么用) Codeforces - 1008C ...

  10. date时间设置

    date +%F时间日期   date  +%Y -%m-%d   年月日 date  +%T   显示时间   HMS几点几分几秒 -%H  为小时 %w  周几 date   -d   “-1da ...