zoukankan      html  css  js  c++  java
  • layout_weight

    比如:

    	<LinearLayout 
    	    android:layout_width="match_parent"
    	    android:layout_height="wrap_content"
    	    android:orientation="horizontal"
    	    android:layout_marginTop="10dip"
    	    style="?android:attr/buttonBarStyle"
    	    >
    		<Button
    		    style="?android:attr/buttonBarButtonStyle" 
    		    android:id="@+id/uploadpb"
    		    android:layout_weight="1"
    		    android:layout_width= "10dip" 
    		    android:layout_height="wrap_content"
    		    android:text="@string/uploadpb" />
    		<Button
    		    style="?android:attr/buttonBarButtonStyle" 
    			android:id="@+id/downloadpb"
    			android:layout_weight="1"
    			android:layout_width= "10dip"
    			android:layout_height="wrap_content"
    			android:text="@string/downloadpb"
    			/>	    
    	</LinearLayout>
    

      

      在这个水平布局的线性布局中,我给每个按钮任意一个layout_width(否则编译时会报错),给每个按钮一个「android:layout_weight="1"」,这样就均等分配了水平空间,like this:

      

      

        用layout_weight是为了适应不同android设备的不同屏幕分辨率

  • 相关阅读:
    UEditor百度编辑器
    form提交
    EL表达式
    spring mvc <mvc;resources>
    filter 拦截ajax请求
    ORACLE 数据库的级联查询 一句sql搞定(部门多级)
    快速排序算法
    实时监听输入框值变化
    javaScript cookie 操作
    webUtil
  • 原文地址:https://www.cnblogs.com/larrylawrence/p/3518449.html
Copyright © 2011-2022 走看看