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. 实现activity全屏显示
  2. Android设置EditText输入类型:setInputType()方法和android:input
  3. Android动画知识汇总
  4. Android(安卓)解决自定义控件布局中match_parent属性无效
  5. android (一)RecycleView组件的使用
  6. Task和Activity相关的一些属性
  7. Android动画开发之Animation动画效果
  8. 你了解Android中的Activity吗?
  9. 【Android】 Activity

随机推荐

  1. android调用系统发送短信 和 已发送短信
  2. Android(安卓)Broadvast简介
  3. 基于ANDROID的网上订餐系统
  4. Android 教程 Android中UI设计的一些技巧
  5. Android 中自定义属性(attr.xml,TypedArr
  6. Android Studio gradle配置详解
  7. 自动 Android* 应用测试
  8. Android(安卓)图片转换为 Base64 编码
  9. js判断用户手机是IOS还是安卓
  10. 用adb抓取log