好多初学者也应该像我一样对安卓中的这三个属性比较陌生,下面把我学到的和大家分享一下。
三个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便。
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了。
相关推荐
有三个值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" > ...
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_width="fill_parent" android:layout_below="@id/textView1" > android:layout_width="fill_parent" android:layout_height="30dip" android:...
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 ...