SwitchCompat 修改颜色
|
Ok, so I'm sorry but most of these answers are incomplete or have some minor bug in them. The very complete answer from @austyn-mahoney is correct and the source for this answer, but it's complicated and you probably just want to style a switch. 'Styling' controls across different versions of Android is an epic pain in the ass. After pulling my hair out for days on a project with very tight design constraints I finally broke down and wrote a test app and then really dug in and tested the various solutions out there for styling switches and check-boxes, since when a design has one it frequently has the other. Here's what I found... First: You can't actually style either of them, but you can apply a theme to all of them, or just one of them. Second: You can do it all from XML and you don't need a second values-v21/styles.xml. Third: when it comes to switches you have two basic choices if you want to support older versions of Android (like I'm sure you do)...
Ok now for the simple reference code. Again if you create a simple Hello World! and drop this code in you can play to your hearts content. All of that is boiler plate here so I'm just going to include the XML for the activity and the style... activity_main.xml...
styles.xml...
I know, I know, you are too lazy to build this, you just want to get your code written and check it in so you can close this pain in the ass Android compatibility nightmare bug so that the designer on your team will finally be happy. I get it. Here's what it looks like when you run it... API_21:
API_18:
|
SwitchCompat 修改颜色的更多相关文章
- |原创|unity 4.3 2D功能SpriteRenderer修改颜色的方法
4.3增加了不少2D功能,然后实在没有找到有人分享,在国外查资料研究一下午然后给个简单的教程 ===================================================== ...
- GankApp 侧滑和title修改颜色的完整项目app
GankApp 侧滑和title修改颜色的完整项目app GankApp 侧滑和title修改颜色的完整项目app,本项目主要由侧滑框架和4.4以及以上的头部title颜色调整和, 首页viewpag ...
- 让控制台支持 ANSI 转义序列,输出下划线、修改颜色或其他控制
各种操作系统的控制台都支持 ANSI 转义序列(ANSI Escape Code).使用转义序列,可以对控制台进行很多额外的定制,例如修改颜色.修改标题栏,将文字添加下划线等. 当然,.NET 已经帮 ...
- iconfont图标symbol引用方式,有的图标不能通过设置color样式来修改颜色的解决办法
现象:iconfont安装后的图标,是通过symbol引用方式,有的图标不能通过color修改颜色的解决办法,有的又可以. <svg class="icon" aria-hi ...
- 2018-10-20-C#-从零开始写-SharpDx-应用-初始化dx修改颜色
title author date CreateTime categories C# 从零开始写 SharpDx 应用 初始化dx修改颜色 lindexi 2018-10-20 17:34:37 +0 ...
- C# 从零开始写 SharpDx 应用 初始化dx修改颜色
原文:C# 从零开始写 SharpDx 应用 初始化dx修改颜色 版权声明:博客已迁移到 https://blog.lindexi.com 欢迎访问.如果当前博客图片看不到,请到 https://bl ...
- DirectX 使用 Vortice 从零开始控制台创建 Direct2D1 窗口修改颜色
本文将告诉大家如何使用 Vortice 底层库从零开始,从一个控制台项目,开始搭建一个最简单的使用 Direct2D1 的 DirectX 应用.本文属于入门级博客,期望本文能让大家了解 Vortic ...
- input placeholder属性 样式修改(颜色,大小,位置)
placeholder属性 样式修改 <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...
- Android之vector代码修改颜色
前言:google给了很多material design icon,在开发过程中,可以下载下来直接使用,下载地址为https://materialdesignicons.com/ . 1.下载图标,并 ...
随机推荐
- 制作动画效果:《CSS3 Animation》
在开始介绍Animation之前我们有必要先来了解一个特殊的东西,那就是"Keyframes",我们把他叫做“关键帧”,玩过flash的朋友可能对这个东西并不会陌生.下面我们就一起 ...
- 2017年1月7日 星期六 --出埃及记 Exodus 21:33
2017年1月7日 星期六 --出埃及记 Exodus 21:33 "If a man uncovers a pit or digs one and fails to cover it an ...
- noip2011提高组day1+day2解题报告
Day1 T1铺地毯https://www.luogu.org/problem/show?pid=1003 [题目分析] 全部读入以后从最后一个往前找,找到一个矩形的范围覆盖了这个点,那这个矩形就是最 ...
- 如何通过Button获取UITableViewCell
发现一个奇怪的问题: 手机(ios7) 2015-06-17 15:11:29.323 ***[1412:60b] [btn superview] = UITableViewCellContent ...
- SqlSever基础 print 在消息中输出hello world
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- Cheatsheet: 2013 07.01 ~ 07.08
.NET The overhead of async/await in NET 4.5 await Task, Task.Wait and Friends 350 Interview Question ...
- Java EE 锚、表格用法
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- 深度信任网络的快速学习算法(Hinton的论文)
也没啥原创,就是在学习深度学习的过程中丰富一下我的博客,嘿嘿. 不喜勿喷! Hinton是深度学习方面的大牛,跟着大牛走一般不会错吧-- 来源:A fast learning algorithm fo ...
- implement Google's Open Source Slam "Cartographer" demos in ROS/rviz
Cartographer is a backpack equipped with Simultaneous Localization and Mapping (SLAM) technology. 1. ...
- 自定义NSLog宏输出
根据编译条件,Debug时输出带行号的日志,Release时关闭日志 /* XCode LLVM XXX - Preprocessing中Debug会添加 DEBUG=1 标志 */ #ifdef D ...

