Android XML属性比较多,全部记住不太现实,用的时候查文档是一条途径。如何迅速找到所需的XML属性?

Android包下面android.R.styleable 类包含下面所有组件相关的XML属性。

如:

public static final int[] LinearLayout_Layout

Since: API Level

Attributes that can be used with a LinearLayout_Layout.

Includes the following attributes:

Attribute Description
android:layout_gravity Standard gravity constant that a child can supply to its parent.
android:layout_height Specifies the basic height of the view.
android:layout_weight
android:layout_width Specifies the basic width of the view.

值得一提的是:android:layout_gravity属性在TextView里面也能用。如设置TextView居中就需要这样:

android:layout_gravity="center_horizontal'.

可是TextView并没有继承android.widget.LinearLayout.LayoutParams。

这说明他们之间的属性是通用的。

更多相关文章

  1. Android(安卓)动画——属性动画Property Animation
  2. 【Android进阶】android:configChanges属性总结
  3. AndroidManifest.xml中android:name功能介绍
  4. Suggestion: add 'tools:replace="android:allowBackup"' to ele
  5. 在AndroidManifest.xml文件中的android:windowSoftInputMode属性
  6. Android进阶(二十二)设置TextView文字水平垂直居中
  7. 常用属性
  8. Android总结篇系列:Android(安卓)Intent
  9. 【Android】Android中 Paint 字体、粗细等属性的一些设置

随机推荐

  1. MySQL8.0中binlog的深入讲解
  2. Mysql中Binlog3种格式的介绍与分析
  3. IDEA链接MySQL报错08001和连接成功后不显
  4. 配置hive元数据到Mysql中的全过程记录
  5. MySQL如何恢复单库或单表,以及可能遇到的
  6. 浅析MySQL 锁和事务
  7. 浅谈MySQL8.0 异步复制的三种方式
  8. MySQL 使用规范总结
  9. 区分MySQL中的空值(null)和空字符('&#39
  10. 详解MySQL数据库之触发器