善用Android预定义样式

字体大小

对于能够显示文字的控件(如TextView EditText RadioButton Button CheckBox Chronometer等等),你有时需要控制字体的大小。Android平台定义了三种字体大小。

"?android:attr/textAppearanceLarge"

"?android:attr/textAppearanceMedium"

"?android:attr/textAppearanceSmall"

使用方法为:

android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="?android:attr/textAppearanceSmall"

style="?android:attr/textAppearanceLarge"
style="?android:attr/textAppearanceMedium"
style="?android:attr/textAppearanceSmall"

字体颜色

android:textColor="?android:attr/textColorPrimary"
android:textColor="?android:attr/textColorSecondary"
android:textColor="?android:attr/textColorTertiary"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textColor="?android:attr/textColorSecondaryInverse"

ProgressBar

style="?android:attr/progressBarStyleHorizontal"
style="?android:attr/progressBarStyleLarge"
style="?android:attr/progressBarStyleSmall"
style="?android:attr/progressBarStyleSmallTitle"

分隔符

横向:

<View android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />

纵向:

<View android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="?android:attr/listDivider" />

CheckBox

style="?android:attr/starStyle"

类似标题栏效果的TextView

style="?android:attr/listSeparatorTextViewStyle"

其它有用的样式

android:layout_height="?android:attr/listPreferredItemHeight"

android:paddingRight="?android:attr/scrollbarSize"

style="?android:attr/windowTitleBackgroundStyle"

style="?android:attr/windowTitleStyle"

android:layout_height="?android:attr/windowTitleSize"

android:background="?android:attr/windowBackground"

更多相关文章

  1. Android预定义样式
  2. Android学习—— Android资料之-系统自带样式Android:theme
  3. Android TextView 设置超链,设置部分字体颜色
  4. android 预定义样式简述
  5. Android样式开发
  6. Android修改自己程序字体的方法详解
  7. Android控制水平方向字体缩放android:textScaleX

随机推荐

  1. Python之字符编码
  2. 【css入门】css盒模型及css定位的常用属
  3. php类的引用与mysql基础
  4. 0324作业-flex布局
  5. 【CSS入门】前端布局神器Flex弹性盒模型
  6. flex布局:flex容器中的四个属性的功能,参数
  7. 红帽认证工程师体系是怎样的?
  8. 美团面试官:说说你对MySQL中InnoDB的了解!
  9. 透过 3.0 Preview 看 Dubbo 的云原生变革
  10. 云服务器是干什么用的?摩杜云带你去了解!