Theam,style

本文介绍了如何在Android应用程序中配置应用的主题和样式。通过定义AppTheme来自定义应用的基本外观,包括主颜色、深色模式下的主颜色以及强调颜色。此外,还展示了如何创建具体的样式并应用于TextView组件上,实现文本大小、颜色及背景色的定制。

Theam

 <!-- Base application theme. -->
    <!--<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

Style

<style name="style1">
        <item name="android:textSize">25dp</item>
        <item name="android:textColor">@color/red</item>
    </style>
    <style name="style2" parent="style1">
        <item name="android:background">@color/yellow</item>
    </style>
<TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="@style/style1"
        android:text="haah"
        android:id="@+id/tv1"/>
    <TextView
        style="@style/style2"
        android:text="haah"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv2"/>

 

转载于:https://www.cnblogs.com/excellencesy/p/9035864.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值