Android笔记整理 一 1.1样式化常见组件

 1.1样式化常见组件


  <TableLayout>
      <TableRow>  <!--一个TableRow代表1行-->
         android:layout_colum="0" <!--第0列-->
      </TableRow> 
    </TableLayout>

android:textStyle   设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2] 可以设置一个或多个,用“|”隔开  

Android——TextView属性XML详解:https://www.cnblogs.com/Chenshuai7/p/5344219.html

RadioButton:单选按钮   RdioGroup是单选组合框:可以容纳多个RadioButton的一个容器

Android基本控件之RadioGroup实现选项栏切换:https://www.cnblogs.com/smilezj/p/6124262.html

style样式继承2种新形式:显式和隐式

主题设置:

<application android:theme=" "> 设置全局主题

<activity android:theme=" "> 设置单个activity主题

系统主题:

API 1:
android:Theme 根主题
android:Theme.Black 背景黑色
android:Theme.Light 背景白色
android:Theme.Wallpaper 以桌面墙纸为背景
android:Theme.Translucent 透明背景
android:Theme.Panel 平板风格
android:Theme.Dialog 对话框风格
 
API 11:
android:Theme.Holo Holo根主题
android:Theme.Holo.Black Holo黑主题
android:Theme.Holo.Light Holo白主题
 
API 14:
Theme.DeviceDefault 设备默认根主题
Theme.DeviceDefault.Black 设备默认黑主题
Theme.DeviceDefault.Light 设备默认白主题
 
API 21: (网上常说的 Android Material Design 就是要用这种主题)
Theme.Material Material根主题
Theme.Material.Light Material白主题
 
兼容包v7中带的主题:
Theme.AppCompat 兼容主题的根主题
Theme.AppCompat.Black 兼容主题的黑色主题
Theme.AppCompat.Light 兼容主题的白色主题

常用主题:

•android:theme="@android:style/Theme.Dialog"   将一个Activity显示为能话框模式
•android:theme="@android:style/Theme.NoTitleBar"  不显示应用程序标题栏
•android:theme="@android:style/Theme.NoTitleBar.Fullscreen"  不显示应用程序标题栏,并全屏
•android:theme="Theme.Light"  背景为白色
•android:theme="Theme.Light.NoTitleBar"  白色背景并无标题栏 
•android:theme="Theme.Light.NoTitleBar.Fullscreen"  白色背景,无标题栏,全屏
•android:theme="Theme.Black"  背景黑色
•android:theme="Theme.Black.NoTitleBar"  黑色背景并无标题栏
•android:theme="Theme.Black.NoTitleBar.Fullscreen"    黑色背景,无标题栏,全屏
•android:theme="Theme.Wallpaper"  用系统桌面为应用程序背景
•android:theme="Theme.Wallpaper.NoTitleBar"  用系统桌面为应用程序背景,且无标题栏
•android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen"  用系统桌面为应用程序背景,无标题栏,全屏
•android:theme="Translucent" 背景为透明
•android:theme="Theme.Translucent.NoTitleBar"  透明背景并无标题栏
•android:theme="Theme.Translucent.NoTitleBar.Fullscreen"  透明背景并无标题栏,全屏
•android:theme="Theme.Panel"  内容容器
•android:theme="Theme.Light.Panel" 背景为白色的内容容器

Android系统主题总结和使用:https://blog.csdn.net/tuke_tuke/article/details/73188426

自定义主题:

<resources>
 
    <!-- 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:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:windowBackground">@color/windowBackground</item>
        <item name="android:textColor">@color/textColor</item>
        <item name="android:colorControlNormal">@color/colorControlNormal</item>
    </style>
    <style name="myTheme" parent="android:t">
 
    </style>
    
</resources>


colorPrimary               应用的主要色调,actionBar默认使用该颜色,Toolbar导航栏的底色
colorPrimaryDark           应用的主要暗色调,statusBarColor默认使用该颜色
statusBarColor             状态栏颜色,默认使用colorPrimaryDark
windowBackground           窗口背景颜色
navigationBarColor         底部栏颜色
colorForeground            应用的前景色,ListView的分割线,switch滑动区默认使用该颜色
colorBackground            应用的背景色,popMenu的背景默认使用该颜色
colorAccent              CheckBox,RadioButton,SwitchCompat等一般控件的选中效果默认采用该颜色
colorControlNormal         CheckBox,RadioButton,SwitchCompat等默认状态的颜色。
colorControlHighlight      控件按压时的色调
colorControlActivated      控件选中时的颜色,默认使用colorAccent
colorButtonNormal          默认按钮的背景颜色
editTextColor:            默认EditView输入框字体的颜色。
textColor                  Button,textView的文字颜色
textColorPrimaryDisableOnly           RadioButton checkbox等控件的文字
textColorPrimary           应用的主要文字颜色,actionBar的标题文字默认使用该颜色
colorSwitchThumbNormal:    switch thumbs 默认状态的颜色. (switch off)

 下一章1.2 切换系统UI元素

猜你喜欢

转载自blog.csdn.net/qq_36408196/article/details/82084994