fill_parent、wrap_content和match_parent的区别:
1)fill_parent
设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Windows控件的dockstyle属性大体一致。设置一个顶部布局或控件为fill_parent将强制性让它布满整个屏幕。
2) wrap_content
设置一个视图的尺寸为wrap_content将强制性地使视图扩展以显示全部内容。以TextView和ImageView控件为例,设置为wrap_content将完整显示其内部的文本和图像。布局元素将根据内容更改大小。设置一个视图的尺寸为wrap_content大体等同于设置Windows控件的Autosize属性为True。
3)match_parent
Android2.2中match_parent和fill_parent是一个意思 .两个参数意思一样,match_parent更贴切,于是从2.2开始两个词都可以用。那么如果考虑低版本的使用情况你就需要用fill_parent了
fill_parent,match_parent两个参数意思一样,只是某大仙觉得match_parent更贴切,于是从2.2开始你两个词都可以用。那么如果考虑低版本的使用情况你就需要用fill_parent了。
下面是两者相同的证据,看android.view.ViewGroup里的静态嵌套类LayoutParams中的代码:
01
public static final int FILL_PARENT = -1;
02 /**
03 * Special value for the height or width requested by a View.
04 * MATCH_PARENT means that the view wants to be as big as its parent,
05 * minus the parent's padding, if any. Introduced in API Level 8.
06 */
07
public static final int MATCH_PARENT = -1;
08 /**
09 * Special value for the height or width requested by a View.
10 * WRAP_CONTENT means that the view wants to be just large enough to fit
11 * its own internal content, taking its own padding into account.
12 */
引用博客地址:
http://blog.csdn.net/xyz_fly/article/details/7837101
相关推荐
有三个值match_parent、fill_parent、wrap_content. 其中match_parent和fill_parent的意义相同,但官方更推荐match_parent. match_parent表示让当前控件的大小和父布局的大小一样,也就是由父布局来决定当前控件的...
1、WRAP_CONTENT、MATCH_PARENT/FILL_PARENT初入Android殿堂的同学们,对这三个属性一定又爱又恨。爱的是使用起来挺爽地---照葫芦画瓢即可,恨的却是时常混淆这几个属性地意义,需要三思而后行。在带着大家重温下这...
android:layout_height="wrap_content" android:layout_gravity="top" > main.xml android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > ...
android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_below="@id/textView1" > android:layout_width="fill_parent" android:layout_height="30dip" android:...
C.wrap_content D.match_content 3.对一些资源以及状态的操作保存,最好是保存在Activity生命周期的哪个函数中进行?B a.onStart() B.onPause() C.onCreate() D.onResume() 4.关于视图控件的常用事件描述中,不...
android:layout_height="wrap_content" android:layout_marginTop="5dip" android:background="#F2F2F2" > android:id="@+id/sayit_ScrollView" android:layout_width="match_parent" android:layout_...
<TextView android:id="@+id/example_row_tv_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textSize="18sp" /> 这个布局...
本文实例讲述了Android实现在xml文件中引用自定义View的... android:layout_height=wrap_content > 方法二: <view class=com.test.copytext.CopyText android:layout_width=match_parent android:layout_height
android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:layout_marginBottom="10dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" ...
利用scrollview来实现,效果会好很多 代码如下: ”@+id/scrollView1″ android:layout_width=”match_...TextView android:id=”@+id/ee_source” android:layout_width=”fill_parent” android:layout_height=”wrap
android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="2dp" android:text="猜猜是哪张" android:textSize="20sp" /> android:id="@+id/button1" ...
mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(circleColor); canvas.drawCircle(bounds.centerX(), bounds.centerY(), outerRadius - outLineWidth, mPaint); // 画边框圆 mPaint.setStyle(Paint....
Fill Memory: Now allows 64-bit addresses Structure Dissect: Fixed the popupmenu "change type" so it now affects all selected entries instead of just the first PointerOrPointee window: Fix the debug ...