`
stephen830
  • 浏览: 2998074 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Android中的FILL_PARENT与WRAP_CONTENT的区别

 
阅读更多

Android中的FILL_PARENT与WRAP_CONTENT的区别

 

 

FILL_PARENT

 

Special value for the height or width requested by a View. FILL_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any. This value is deprecated starting in API Level 8 and replaced by MATCH_PARENT .

 

fill_parent布局指将视图扩展以填充所在容器(也就是父容器)的全部空间。


WRAP_CONTENT

 

Special value for the height or width requested by a View. WRAP_CONTENT means that the view wants to be just large enough to fit its own internal content, taking its own padding into account.

 

wrap_content布局指根据视图内部内容自动扩展以适应其大小。

 

 

分享到:
评论

相关推荐

    android中ratingbar的简单使用

    android:layout_width="fill_parent" android:layout_height="fill_parent" > android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> android:id=...

    SendSms.zip

    android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="fill_horizontal" > android:id="@+id/address" android:layout_width="fill_parent" android:layout_height=...

    计算器(android)

    <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"> <Button android:id="@+id/mButton5" android:layout_...

    Android 五大布局

    在Android开发中,UI设计是至关重要的,而布局管理器是构建用户界面的基础。本文将详细介绍Android中的五大布局:FrameLayout、LinearLayout、AbsoluteLayout、RelativeLayout和TableLayout。 **FrameLayout**是最...

    [Android应用开发电子书]

    android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/ImageView1" android:layout_width="wrap_...

    点按弹出按钮组件

    android:layout_width="fill_parent" android:layout_height="fill_parent" zhy:position="left_top" zhy:radius="130dp" > android:layout_width="wrap_content" android:layout_height="wrap_content" ...

    login_interface

    android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="15dip" android:background="@drawable/background_login" android:padding="15dip" > android:id="@+...

    Android 教程 PDF

    可以设置为`"fill_parent"`(占据父容器全部空间)、`"match_parent"`(与`"fill_parent"`等效)或`"wrap_content"`(根据内容自动调整尺寸)。 **1.2 示例代码** ```xml <LinearLayout xmlns:android=...

    AndroidHttps服务器端和客户端简单实例

    main.xml代码如下: <?xml version="1.0" encoding="utf-8"?... android:layout_height="wrap_content" android:text="HTTPS Test" /> 将该Android项目运行起来,点击按钮,在logcat中就可以看到打印信息:

    android 右侧滑动菜单 主页滑动 窗帘效果 拉幕

    android:layout_width="wrap_content" android:layout_height="fill_parent"> <include layout="@layout/main_left" /> android:id="@+id/sliding_menu_view" android:layout_width="fill_parent" android...

    Android_如何置底一个View(附_前置声明layout布局文件中的资源ID)

    在Android开发中,视图(View)的布局和排列是非常关键的一部分,尤其是在创建复杂的用户界面时。本篇文章将详细介绍如何在Android中将一个View置底,并通过实例解释如何在RelativeLayout布局中实现这一目标。同时,...

    android左右滚动焦点图【改】

    android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical"> android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height=...

    Android控件大全以及各布局空间的使用方式

    - `android:layout_width` 和 `android:layout_height`: 设置布局的宽度和高度,可以使用 `fill_parent` 或 `match_parent` 让布局填充整个父容器,`wrap_content` 让布局根据内容自动调整大小,也可以直接指定像素...

    Android常用控件的基本使用说明.doc

    android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image" /> _ImageView.java 代码 package com.webabcd.view; import android.app.Activity; import android....

    android自定义弹出框

    android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:layout_width="135dip" android:textSize="18sp" android:layout_height="45dip" android:text="确定" android:id...

    Android Button事件的实现

    android:layout_width="fill_parent" android:layout_height="fill_parent"> android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="这是ACTIVITY01"/> android:id="@+...

    Android布局

    - **android:layout_width** 和 **android:layout_height**:用于设定视图的宽高,可以选择`wrap_content`(视图自动调整大小以匹配内容)或`match_parent`(视图大小与父容器相同)。 **示例代码**: ```xml ...

    android项目_-天气预报详解实例(免费)

    android:layout_height="fill_parent"> android:id="@+id/tvPlace" android:layout_width="fill_parent" android:layout_height="wrap_content" /> android:id="@+id/place" android:layout_width="fill_...

    Android页面布局总结

    `wrap_content`用于使视图的大小适应其内容,而`match_parent`(等同于`fill_parent`)则使视图填充整个父容器。 通过以上介绍,我们可以看出,选择合适的布局类型对于优化用户界面至关重要。每种布局都有其独特的...

Global site tag (gtag.js) - Google Analytics