getLayoutParams()


/**

* Get the LayoutParams associated with this view. All views should have

* layout parameters. These supply parameters to the <i>parent</i> of this

* view specifying how it should be arranged. There are many subclasses of

* ViewGroup.LayoutParams, and these correspond to the different subclasses

* of ViewGroup that are responsible for arranging their children.

*

* This method may return null if this View is not attached to a parent

* ViewGroup or {@link #setLayoutParams(android.view.ViewGroup.LayoutParams)}

* was not invoked successfully. When a View is attached to a parent

* ViewGroup, this method must not return null.

*

* @return The LayoutParams associated with this view, or null if no

* parameters have been set yet

*/

译文:得到与之相关联的view的布局参数。所有的view都应该有一个布局参数。这些特定view的参数会被应用到父布局里面指定view应该如何进行布局。这里有许多视图组布局参数的子类,并且这些不同视图组子类之间的通信负责安排她们的字空间。

@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")

public ViewGroup.LayoutParams getLayoutParams() {

return mLayoutParams;

}


getLayoutParams().height

/**

* Information about how tall the view wants to be. Can be one of the

* constants FILL_PARENT (replaced by MATCH_PARENT

* in API Level 8) or WRAP_CONTENT, or an exact size.

*/

@ViewDebug.ExportedProperty(category = "layout", mapping = {

@ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),

@ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")

})

public int height;


getLayoutParams().width

/**

* Information about how wide the view wants to be. Can be one of the

* constants FILL_PARENT (replaced by MATCH_PARENT

* in API Level 8) or WRAP_CONTENT, or an exact size.

*/

@ViewDebug.ExportedProperty(category = "layout", mapping = {

@ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),

@ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")

})

public int width;

更多相关文章

  1. 【黑马Android】(02)短信发送器/布局演示/android下单位/android
  2. Android SDKVersion 参数列表
  3. Android布局优化(四)X2C — 提升布局加载速度200%
  4. Android相对布局实现各种梅花效果
  5. Android中常用布局属性
  6. Android初级教程理论知识(第二章布局&读写文件)
  7. XML布局
  8. Android之布局参数

随机推荐

  1. Android快速自定义控件+实战演示(二)组合自
  2. android P版本 系统稳定性问题案例分析(
  3. Android触摸反馈(回顾整理):触摸事件的分发
  4. Android中加密机制
  5. Android(安卓)插件化和热修复知识梳理
  6. android之存储篇_SQLite数据库_让你彻底
  7. 基于Android的点对点视频通信/RTSP/RTP/H
  8. [置顶] Android(安卓)ListView点击之后保
  9. 向各位Android初学者 吐血推荐《Android
  10. 【译】Android中的安全数据-初始化向量