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

android:layout_weight详解

 
阅读更多

android:layout_weight只在LinearLayout内部的控件才有的属性。

 

在LinearLayout的width为fill_parent,内部控件android:layout_width="wrap_content"时。weight为占的分量。

某个控件的宽度为weight/总weight。其实这个weight就是实现百分比设置宽度。

 

 

fill_parent有个特殊的用途。一行有很多控件。最后一个设置成fill_parent可以填充剩余空间。

如果在linearLayout中某控件在前,其他在后固定宽高,这个控件如果要填充剩余部分weight可设置成1.其他的为0。

我的话费充值店-各种面额
电信100元仅售98.60 

联通100仅售99.00
移动100仅售99.30

分享到:
评论

相关推荐

    Layout_Gravity

    android:layout_gravity 属性详细解读

    android:layout_gravity和android:gravity的区别

    1.首先来看看Android:layout_gravity和android:gravity的使用区别。 android:gravity: 这个是针对控件里的元素来说的,用来控制元素在该控件里的显示位置。例如,在一个Button按钮控件中设置如下两个属性, android...

    androidlayout-marginBottom的值为负数.docx

    为什么有时候像android:layout_marginBottom等变量的赋值为负数? 例如如下代码:  android:orientation="vertical"  android:id="@id/Widget_2X4_frame"  android:layout_width="fill_parent"  android:...

    layout_gravity和gravity区别以及应用

    layout_gravity 在 线性布局 和 帧布局 中的应用 通过代码 直观的展示 layout_gravity 和 gravity 的区别

    Android中gravity与layout_gravity的使用区别分析

    android:layout_gravity:设置控件本身相对于父控件的显示位置。 看下如下代码段 代码如下:<?xml version=”1.0″ encoding=”utf-8″?><!– android:gravity设置了按钮上面的文字的显示位置,而android:...

    2011.10.13(4)——— android android:layout_weight

    NULL 博文链接:https://trylovecatch.iteye.com/blog/1195121

    android_QQ_例子

    用Eclipse加载项目工程 <LinearLayout xmlns:android=... android:layout_weight="0.66" android:background="@drawable/blue_bg" android:orientation="vertical" > android:layout

    android-autofittextview-master.zip_android_android textview_auto

    android:layout_width= match_parent android:layout_height= wrap_content > <Button android:layout_width= match_parent android:layout_height= wrap_content android:singleLine= true /&gt...

    Android 五种Layout 布局

    介绍Android五中布局的一个示例代码.

    Android实训购物车页面

    -<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...

    Android购物车代码

    -<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...

    Android中的android:layout_weight使用详解

    layout_weight的作用是设置子空间在LinearLayout的重要度(控件的大小比重)。layout_weight的值越低,则控件越重要,下面为大家介绍下具体的使用方法

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

    android:layout_weight="1" android:layout_height="wrap_content" android:text="行1列2" /> <TextView android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content...

    Android 百分比布局

    android:layout_weight="1" android:orientation="horizontal"> android:id="@+id/tv_solid_number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="本次上架...

    Android 重写RadioButton,模仿QQ消息气泡

    android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/icon_click_wd" android:gravity="center" android:text="我的" android:textSize="10dp" /> --设置值,显示气泡 rb_...

    Android_Layout_之_RelativeLayout_代码实现相对布局

    点对点 Android_Layout_之_RelativeLayout_代码实现相对布局 使用

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

    android_layout属性大全

    android_layout属性大全,包括layou的各种属性的汉语意思.方便查找对应个属性

    android实验2界面设计:基本组件.doc

    -- 在主布局添加文本框和密码框 --> <TextView android:text = "@string/password" android:layout_width="match_parent" android:layout_height="wrap_content"/> <EditText android:id="@+id/password" android:...

    Get清风android实验2界面设计:基本组件.doc

    -- 在主布局添加文本框和密码框 --> <TextView android:text = "@string/password" android:layout_width="match_parent" android:layout_height="wrap_content"/> <EditText android:id="@+id/password" android:...

Global site tag (gtag.js) - Google Analytics