`

match_parent和fill_parent的区别 .

 
阅读更多

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

转:http://blog.csdn.net/junjieking/article/details/7067855

分享到:
评论

相关推荐

    Android学习笔记

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

    tab布局代码

    android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_...

    Android TabHost组件使用方法详解

    android:layout_width="match_parent" android:layout_height="match_parent"> android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> android:id=...

    Android中使用LinearLayout完成的内蒙古导览项目的代码清单 .pdf

    `layout_width`和`layout_height`都设置为`fill_parent`,表示占据父容器的全部宽度和高度。`orientation`属性设置为`vertical`,意味着子视图将按垂直方向排列。 在LinearLayout中,我们有一个TextView和一个...

    Android开发教程之Android 五大布局--千锋培训

    android:layout_width="fill_parent" android:layout_height="fill_parent"> android:text="button" android:layout_width="fill_parent" android:layout_height="wrap_content" /> android:text=...

    自定义ScrollView 实现图片放大,上滑修改标题栏状态

    android:layout_height="match_parent"> android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <androidx.appcompat.widget.AppCompatImageView ...

    ViewPager_fragment结合实现tab的4种方法

    android:layout_width="fill_parent" android:layout_height="wrap_content" /> android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0" ...

    高仿新版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_...

    布局精解文档

    android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height=...

    Fragment制作tab样式向下兼容代码

    android:layout_height="match_parent"> android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> android:id="@android:id/tabs" android:layout_...

    安卓zxing 代码demo

    android:layout_height="match_parent"> android:id="@+id/second_button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|center_...

    android4.0 tabhost demo

    android:layout_width="match_parent" android:layout_height="match_parent"> android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> android:...

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

     android:layout_width="match_parent"  android:layout_height="match_parent">  <android.support.v4.view.ViewPager  android:id="@ id/viewpager_default"  android:layout_width="match_parent"  ...

    自定义tabhost

    android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" android:background="@drawable/tab_background"> <!-- ...

    Android笔试95题[文].pdf

    D.match_content并不是一个有效的属性值,正确选项是A.match_parent、B.fill_parent(与match_parent同义)和C.wrap_content。 6. 资源和状态保存的最佳时机: 最好在B.onPause中保存,因为这是Activity进入后台...

    解决Android TabLayout 在宽屏幕上tab不能平均分配的问题

    android:layout_width="match_parent" android:layout_height="wrap_content" /> ``` 问题描述 当TabLayout 在宽屏幕的设备上,如平板横屏的时候,tab的宽度超过一定值后,就不在平均分配宽度,而是居中显示。...

    QQ下拉框,popupwindow

    mPopupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); mPopupWindow.setOutsideTouchable(true); // 设置外部可触摸,以便点击外部关闭 ...

    Android的Layout完全介绍

    android:layout_width="fill_parent" android:layout_height="fill_parent"> android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="I am textview 1" /> android:...

    计算器源代码

    android:layout_height="fill_parent" android:weightSum="1"> android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> android:layout_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_...

Global site tag (gtag.js) - Google Analytics