zoukankan      html  css  js  c++  java
  • 布局文件中fill_parent和match_parent有什么区别?



    1)fill_parent设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Windows控件的dockstyle属性大体一致。设置一个顶部布局或控件为fill_parent将强制性让它布满整个屏幕。2)match_parent Android2.2中match_parent和fill_parent是一个意思 .两个参数意思一样,match_parent更贴切,于是从2.2开始两个词都可以用。那么如果考虑低版本的使用情况你就需要用fill_parent了

    有网友表示对于很多工程中的MATCH_PARENT出现在layout中感到不明白,过去只有FILL_PARENT和WRAP_CONTENT那么match_parent到底是什么类型呢? 其实从Android 2.2开始FILL_PARENT改名为MATCH_PARENT ,从API Level为8开始我们可以直接用MATCH_PARENT来代替FILL_PARENT,最后Android123提醒大家,他们的定义本质是一样均为-1,只是换了个别名,可能为了更准确些,比如最终在SDK中的定义为:

    fill_parent   -1  The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent.  
    match_parent   -1 The view should be as big as its parent (minus padding). Introduced in API Level 8.  
    wrap_content   -2  The view should be only big enough to enclose its content (plus padding).  

  • 相关阅读:
    Java网络编程
    IDEA maven-3.6.2 Unable to import maven project错误
    Java通过ArrayList的contains(Object o)方法实现去重字符串中的字符
    常用的Unicode值范围
    Java函数(方法)的默认值问题
    [Noip2017]宝藏
    [Noip2017]组合数问题
    [Noip2018]赛道修建
    [Noip2018]旅行(数据加强版)
    [Noip2019]树的重心
  • 原文地址:https://www.cnblogs.com/mochaMM/p/5092539.html
Copyright © 2011-2022 走看看