Android样式主题及自定义属性


<resources>
<style name="sss" parent="@android:style/Theme.Holo.Light.Dialog"></style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<!--标题栏-->
<item name="colorPrimary">@color/colorPrimary</item>
<!--状态栏-->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!--系统中,子空间,复选框,单选按钮,选中时的颜色-->
<item name="colorAccent">@color/colorAccent</item>
<!--窗体的背景色-->
<item name="android:windowBackground">@android:color/white</item>
<!--窗体无标题栏-->
<item name="windowNoTitle">true</item>
<!--无actionbar-->
<item name="windowActionBar">false</item>
<!--取消状态栏,也就是全屏显示-->
<item name="android:windowFullscreen">true</item>
</style>
<!--需要注意的是,不能有空格,值不用引号-->
<style name="bottom_bar_rb">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:layout_marginBottom">5dp</item>
<item name="android:gravity">center</item>
<item name="android:layout_weight">1</item>
<item name="android:button">@null</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/selector_bar_font_1</item>
</style>
</resources>

<?xml version="1.0" encoding="utf-8"?>
<!--默认矩形-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> <!--纯色-->
<solid android:color="@color/colorAccent"/> <!--圆角-->
<!-- android:radius="100dp"四个角都是圆角-->
<corners
android:bottomLeftRadius="100dp"
android:topRightRadius="100dp"/> <!--边框-->
<!--android:dashWidth="50dp线段长-->
<!--android:dashGap="20dp"线段之间的间隔-->
<stroke
android:width="10dp"
android:color="@color/colorPrimary"
android:dashWidth="50dp"
android:dashGap="20dp"/>
<!--大小-->
<size
android:width="200dp"
android:height="200dp"/> <padding
android:left="20dp"
android:top="20dp"
android:bottom="20dp"
android:right="20dp"/>
<!--渐变-->
<!--默认左右渐变-->
<!--android:centerColor="@color/colorPrimary" 三色渐变-->
<!--渐变类型,默认为linear android:type="linear"-->
<!--注意,这个属性的值只能是45的倍数,并且只能在linear中使用-->
<!--<gradient-->
<!--android:centerColor="@color/colorPrimary"-->
<!--android:startColor="#fff"-->
<!--android:endColor="@color/colorAccent"-->
<!--android:type="linear"-->
<!--android:angle="-90"/>--> <!--android:type="radial" 径向渐变-->
<!--注意必须设置径向渐变半径-->
<!--<gradient-->
<!--android:centerColor="@color/colorPrimary"-->
<!--android:startColor="#fff"-->
<!--android:endColor="@color/colorAccent"-->
<!--android:type="radial"-->
<!--android:gradientRadius="200"-->
<!--android:centerX="0.5"-->
<!--android:centerY="0.3"/>--> <!--扫描线-->
<!--也可以设置中心点,默认是0.5XY-->
<gradient
android:centerColor="@color/colorPrimary"
android:startColor="#fff"
android:endColor="@color/colorerAccent"
android:type="sweep"
android:centerX="0.5"
android:centerY="0.5"/> </shape>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="3dp"
android:color="@color/colorPrimary"
android:dashGap="20dp"
android:dashWidth="50dp"/>
</shape>

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<!--这里边的属性都可以使用-->
<solid android:color="@color/colorAccent" />
<!--宽高相等,会变成圆形-->
<size
android:width="50dp"
android:height="200dp" />
</shape>

<!--环形-->
<!--固定值,好处,固定大小不变,但是不能根据控件大小变化-->
<!--android:innerRadius="" 内环半径 android:thickness="" 环厚度-->
<!--**** android:useLevel="false"必须为false,
默认为true,为false时显示*****-->
<!--比例
android:innerRadiusRatio=""
android:thicknessRatio=""-->
<!--控件的宽度/5,内环的半径 控件的宽度/7,环厚度-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadiusRatio="5"
android:thicknessRatio="7"
android:useLevel="false">
<solid
android:color="@color/colorAccent"/>
</shape>
Android样式主题及自定义属性的更多相关文章
- Android 样式 (style) 和主题(theme)
转载:https://gold.xitu.io/post/58441c48c59e0d0056a30bc2 样式和主题 样式是指为 View 或窗口指定外观和格式的属性集合.样式可以指定高度.填充.字 ...
- Android 样式和主题(style & theme)
Android 样式 android中的样式和CSS样式作用相似,都是用于为界面元素定义显示风格,它是一个包含一个或者多个view控件属性的集合.如:需要定义字体的颜色和大小. 在CSS中是这样定义的 ...
- Android样式(style)和主题(theme)
样式和主题 样式是指为 View 或窗口指定外观和格式的属性集合.样式可以指定高度.填充.字体颜色.字号.背景色等许多属性. 样式是在与指定布局的 XML 不同的 XML 资源中进行定义. Andro ...
- android中的样式主题和国际化
一.Android中的样式和主题 1.1样式 样式是作用在控件上的,它是一个包含一个或者多个view控件属性的集合.android style类似网页设计中的css设计思路,可以让设计 ...
- 【转载】总结一下Android中主题(Theme)的正确玩法
http://www.cnblogs.com/zhouyou96/p/5323138.html 总结一下Android中主题(Theme)的正确玩法 在AndroidManifest.xml文件中有& ...
- Android 切换主题以及换肤的实现
Android 切换主题以及换肤的实现 一.介绍 现在市面上有很多 APP 有切换主题和皮肤的功能!特别是阅读类的 APP! 上面两张图分别是 知乎 APP 和Fuubo APP的两张截图!都带有切换 ...
- [转]Android样式的开发:shape篇
转载自Keegan小钢原文链接:http://keeganlee.me/post/android/20150830 Android样式的开发:shape篇Android样式的开发:selector篇A ...
- MVC4 jquery 样式 主题 用法(案例)
MVC4已经自带了jquery,新建的项目,基本上什么都不用添加就可以运行,跑项目.(集成了那么多东西,jquery,modernizr,自带的默认权限,生成的模板,但是缺没有一个统一的文档或者什么去 ...
- [置顶]
xamarin android自定义标题栏(自定义属性、回调事件)
自定义控件的基本要求 这篇文章就当是自定义控件入门,看了几篇android关于自定义控件的文章,了解了一下,android自定义控件主要有3种方式: 自绘控件:继承View类,所展示的内容在OnDra ...
随机推荐
- Spring Data Redis 详解及实战一文搞定
SDR - Spring Data Redis的简称. Spring Data Redis提供了从Spring应用程序轻松配置和访问Redis的功能.它提供了与商店互动的低级别和高级别抽象,使用户免受 ...
- [原创]K8Cscan插件之存活主机扫描
[原创]K8 Cscan 大型内网渗透自定义扫描器 https://www.cnblogs.com/k8gege/p/10519321.html Cscan简介:何为自定义扫描器?其实也是插件化,但C ...
- .NET图平台下的图像处理工具---强大的Emgucv
图像一直与时代相伴,图形化的应用软件也重不可缺.对于MFC.Delphi.Lazarus.Qt大家可能已经耳熟能详.对于很多图像处理的开源库,很多都是用C\C++写的,而.Net下的开源库以前很少了解 ...
- elasticsearch 操作
文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html 客户端:https://www.elasti ...
- UVa OJ 120
Background背景 Stacks and Queues are often considered the bread and butter of data structures and find ...
- 05 Tensorflow中变量的初始化
打开Python Shell,输入import tensorflow as tf,然后可以执行以下代码. 1.创建一个2*3的矩阵,并让所有元素的值为0.(类型为tf.float) a = tf.ze ...
- mysql数据库中的数据导入与导出
需求: 在本地电脑上的mysql中创建了一个数据库,并且在该数据库中创建了很多表,表中数据比较多: 现在想换一台电脑,但是又不想重新建数据库.建表.造数据. 解决方案: 利用mysql提供的命令,在本 ...
- Python中return self的用法
在Python中,有些开源项目中的方法返回结果为self. 对于不熟悉这种用法的读者来说,这无疑使人困扰,本文的目的就是给出这种语法的一个解释,并且给出几个例子. 在Python中,retur ...
- EntityFramework(1)基础概念与Database First
基本概念 EntityFramework是微软推出的一款ORM工具,关于ORM的概念请参考博客https://www.cnblogs.com/huanhang/p/6054908.html.这篇文章对 ...
- WebBrowser(IE) 与 JS 相互调用
在开发中我们经常将WebBrowser控件嵌入Winform 程序来浏览网页,既然是网页那么少不了JS.下面就让我们来说说他们两之间的相互调用. 在C#封装的浏览器内核中,Chromium 内核封装有 ...