`
tudusi
  • 浏览: 1048903 次
文章分类
社区版块
存档分类
最新评论

关于"match_parent"这个xml的布局设定值

 
阅读更多
android:layout_width="match_parent"

android:layout_height="match_parent"


"match_parent" 这个设置值 Since: API Level 8

public static final int MATCH_PARENT

Since: API Level 8

Special value for the height or width requested by a View. MATCH_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any. Introduced in API Level 8.

Constant Value: -1 (0xffffffff)

因此当你使用sdk2.2以下来编译时,编译会通不过!


再来看看下面这个

public static final int FILL_PARENT

Since: API Level 1

Special value for the height or width requested by a View. FILL_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any.This value is deprecated starting in API Level 8 and replaced byMATCH_PARENT.

Constant Value: -1 (0xffffffff)

也就是说,当你使用2.2以上的sdk编译成的app运行在2.2以下系统的手机上, "match_parent"的使用就赞同于使用了“full_parent”,因此这个值的设置对app的多os版本运行是没有影响的!!!



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics