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之ListView中的分割线和行高
  2. Android的CheckBox控件的点击效果布局文件
  3. android自定义滚动条(ScrollBar)样式
  4. LinearLayout && RelativeLayout 常用属性
  5. 关于android:configChanges的属性
  6. android 中的 edittext属性大全
  7. Android(安卓)SDK 安装中组件的离线安装方法 (share)
  8. Android学习笔记:androidmanifest.xml 高级属性
  9. android 拨号盘Contact模块讲解(四)

随机推荐

  1. Android通信之 Bluetooth
  2. Android——Handler和AsyncTask的使用
  3. Android Fragments 详细使用详细介绍
  4. Android安全模型之Android安全机制(进程通
  5. Android 的启动流程
  6. 应用phprpc协议实现Android客户端的一些
  7. Windows环境下Android Studio v1.0安装教
  8. Android(安卓)中 startService()启动serv
  9. Android布局常用控件
  10. Android Studio 开发经验纵览