zoukankan      html  css  js  c++  java
  • Android布局学习

    习惯了Delphi/VB等RAD的拖放布局,使用Android的布局管理器还真不习惯.

    例如要实现下面的界面布局: 


    则需要如下设置:

     1 <LinearLayout
     2         android:layout_width="wrap_content"
     3         android:layout_height="wrap_content"
     4         android:orientation="horizontal" >
     5 
     6         <TextView
     7             android:id="@+id/textView1"
     8             android:layout_width="wrap_content"
     9             android:layout_height="wrap_content"
    10             android:text="编码" />
    11 
    12         <EditText
    13             android:id="@+id/editText1"
    14             android:layout_width="match_parent"
    15             android:layout_height="wrap_content"
    16             android:layout_weight="2"
    17             android:ems="10" >
    18 
    19             <requestFocus />
    20         </EditText>
    21         
    22 
    23         <TextView
    24             android:id="@+id/textView2"
    25             android:layout_width="wrap_content"
    26             android:layout_height="wrap_content"
    27             android:text="名称" />
    28         
    29 
    30 
    31 
    32 
    33         <EditText
    34             android:id="@+id/editText2"
    35             android:layout_width="wrap_content"
    36             android:layout_height="wrap_content"
    37             android:layout_weight="1"
    38             android:ems="10" >
    39 
    40             <requestFocus />
    41         </EditText>
    42       

    43     </LinearLayout> 

    这里比较重要的属性是:

    android:layout_weight

    该属性是设置比重的,但设置好像是反的,TextView就不要设置这个属性了,要不然显示会比较令人郁闷的. 

  • 相关阅读:
    JavaWeb开发小结
    第一个Maven案例Hello Maven
    数据字典 dba_free_space及相对文件号RELATIVE_FNO 小结
    执行计划
    五分钟搞死一台服务器
    RAC 移动 OCR
    使用DBMS_STATS来收集统计信息【转】
    关于Freelists和Freelist Groups的研究【转】
    [转]Oracle中INITRANS和MAXTRANS参数
    linux套件安装过程中configure,make,make install的作用
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/2478443.html
Copyright © 2011-2022 走看看