[android] 安卓自定义样式和主题
简单练习自定义样式和主题,样式是加在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" >
十年开发经验程序员,离职全心创业中,历时三年开发出的产品《唯一客服系统》
一款基于Golang+Vue开发的在线客服系统,软件著作权编号:2021SR1462600。一套可私有化部署的网站在线客服系统,编译后的二进制文件可直接使用无需搭开发环境,下载zip解压即可,仅依赖MySQL数据库,是一个开箱即用的全渠道在线客服系统,致力于帮助广大开发者/公司快速部署整合私有化客服功能。
开源地址:唯一客服(开源学习版)
官网地址:唯一客服官网