Android 布局样式和主题

样式和主题

样式:可以指定控件的显示形式

样式的继承:

   
   
<style name="my_textview_style_small" parent="@style/my_textview_style">
    
    
也可以使用
<style name = "父类样式名.子类的样式名"></style>
这样就表示了样式的继承了

css 样式 ,通用的样式模板,继承 

   
   
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="my_textview_style">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#0000ff</item>
<item name="android:textSize">25sp</item>
</style>
<style name="my_textview_style_small" parent="@style/my_textview_style">
<item name="android:textSize">15sp</item>
</style>
<style name="my_textview_style.my_textview_style_verylarge" >
<item name="android:textSize">45sp</item>
</style>
</resources>
主题:主题和样式在声明的时候没有任何的区别,
样式和主题的区别: 在定义上没有任何区别, 区别是在使用上, 
样式的作用范围:作用在控件上(textView,ImageView,Button) 
主题的作用范围:作用在一个activity上,或者作用在整个应用程序上。
仿照系统的透明主题:
    
    
<style name="my_theme">
<item name="android:windowBackground">@color/trans</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值