`
zhangyf1987hb
  • 浏览: 80516 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

MATCH_PARENT和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).  

分享到:
评论

相关推荐

    Android学习笔记

    LinearLayoutCompat 线性布局 ...其中match_parent和fill_parent的意义相同,但官方更推荐match_parent. match_parent表示让当前控件的大小和父布局的大小一样,也就是由父布局来决定当前控件的大小 wrap_con

    高仿新版58加载动画Android-shapeLoadingView.zip

     android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"  android:paddingRight="@dimen/activity_horizontal_margin"  android:paddingTop="@dimen/activity_...

    CircleIndicator-一个轻量级的viewpager指示器 ,类似于nexus5 启动器的效果.zip

     android:layout_width="match_parent"  android:layout_height="match_parent">    android:id="@ id/viewpager_default"  android:layout_width="match_parent"  android:layout_height="match_...

    Android中measure过程、WRAP_CONTENT详解以及

    1、WRAP_CONTENT、MATCH_PARENT/FILL_PARENT初入Android殿堂的同学们,对这三个属性一定又爱又恨。爱的是使用起来挺爽地---照葫芦画瓢即可,恨的却是时常混淆这几个属性地意义,需要三思而后行。在带着大家重温下这...

    CircularBarPager-可实现多个进度同时进行或按步进行的进度条.zip

     android:layout_height="match_parent"  android:layout_width="match_parent"  android:paddingLeft="30dp"  android:paddingRight="30dp"  android:layout_centerInParent="true"  app:progress_pager...

    Android代码-android菜单控制器view

    * PinterestView'layoutParams must match_parent or fill_parent, * just for cover the whole screen */ pinterestView = (PinterestView) findViewById(R.id.item_layout); /** * add item view into ...

    android 图片操作(缩放移动) 实例代码

    view_show.xml 代码如下:<?xml version=”1.0″ encoding=”utf-8″?>”http://schemas.android.com/apk/res/android” android:orientation=”...FrameLayout android:layout_height=”fill_parent” 

    DrawerLayout

    抽屉效果:DrawerLayout控件里面:整体的界面分为两部分:第一部分放置我们的主界面里的东西:抽屉外面的部分;第二部分:是抽屉里面的效果 ...抽屉的宽度不能是match_parent/fill_parent, ②.要设置抽屉打开的方向:

    从零开始学android实现计算器功能示例分享(计算器源码)

    下面是效果展示: 代码如下:<?xml version=”1.0″ encoding=”utf-8″?>”http://schemas.android.com/apk/res/android” android:layout_width=...LinearLayout android:layout_width=”fill_parent” andr

    CircleProgressbar:一个Android CircleProgressbar

    CircleProgressbar这是一个圆形的进度条,继承自View类。可以自定义颜色和大小。#demo这是预览的效果#用法<..._width="match...

    android顶部滑动导航

    android:layout_width="match_parent" android:layout_height="match_parent" android:background="#F0EFF5" > android:id="@+id/sayit_rl_tab" android:layout_width="fill_parent" android:layout_...

    移动终端应用开发题库

    B.fill_parent C.wrap_content D.match_content 3.对一些资源以及状态的操作保存,最好是保存在Activity生命周期的哪个函数中进行?B a.onStart() B.onPause() C.onCreate() D.onResume() 4.关于视图控件的常用...

    SwipeListViewTest项目

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- linearlayout中的布局是每一项后面隐藏的布局 --> ...

    viewpager相关

    android:layout_height="match_parent" android:orientation="vertical" > android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="第一个...

    星座说明书

    android:layout_height="fill_parent" > 3.1.3功能  主要功能:1.美化星座查询系统,吸引用户。  2.自动跳转进入下一个Activity界面。  3.创建线程对象,然后自动调用了run()方法     3.2查询主界面 ...

    android layout 按比例布局的代码

    为了创建比例大小的子View,可以将LinearLayout的宽度和高度设为fill_parent, 而将子View的宽度或是高度设为0,然后为子View设置不同权重(weight) ,这样子View的大小就会权值成比例。 本例使用横向LinearLayout,...

    Android开发实现拨打电话与发送信息的方法分析

    本文实例讲述了Android开发实现拨打电话与发送信息的方法。分享给大家供大家参考,具体如下: xml布局: android:layout_width=fill_parent android:layout_height=fill_... android:layout_width=match_parent a

    Android抽奖轮盘的制作方法

    本文实例为大家分享了Android抽奖轮盘的具体代码,供大家参考,具体内容如下 main布局(图片资源请自行寻找,抱歉) android:layout_width=fill_parent android:layout_height=... android:layout_width=match_parent

    Android实现在xml文件中引用自定义View的方法分析

    android:layout_width=fill_parent android:layout_height=wrap_content > 方法二: <view class=com.test.copytext.CopyText android:layout_width=match_parent android:layout_height

Global site tag (gtag.js) - Google Analytics