zoukankan      html  css  js  c++  java
  • RelativeLayout总结

    RelativeLayout关系布局:

     

    在form中的用法:"@[+][package:]type:name"   (@id/viewName)

    在主题模式form中的用法: "?[package:][type:]name".(还没见过相关的例子)

     

    android:layout_above VS android:layout_below:

    设定当前view和相关的view在垂直方向上的关系,above是上相关view的上面,below是在相关view的下面,above让当前view的下面界和相关view的上边界对齐。相反below则是将当前view和相关view的上边界对齐。

    在form中的用法:"@[+][package:]type:name"   (@id/viewName)

    在主题模式form中的用法: "?[package:][type:]name".(还没见过相关的例子)

     

    android:layout_alignBaseline

    大概相当于水平中心线对齐。

    android:layout_alignBottom

    android:layout_alignLeft

    android:layout_alignRight

    android:layout_alignTop

    以上这些同理。

     

    android:layout_alignParentBottom

    android:layout_alignParentLeft

    android:layout_alignParentRight

    android:layout_alignParentTop

    android:layout_centerHorizontal

    android:layout_centerInParentc

    android:layout_centerVertical

    以上四项是指在父容器中的位置。

     

    android:layout_alignWithParentIfMissing

    If set to true, the parent will be used as the anchor when the anchorcannot be be found for layout_toLeftOf, layout_toRightOf, etc.

    如果设为true,当找不到toLeftOf或toRightOf的view的时候,父容器将成为锚点,以父容器做为布局的依据。

     
    代码


    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation
    ="vertical" android:layout_width="fill_parent"

    android:layout_height
    ="fill_parent">

    <TextView android:id="@+id/label" android:layout_width="fill_parent"

    android:layout_height
    ="wrap_content" android:text="Type here:" />

    <EditText android:id="@+id/txt" android:layout_width="match_parent"

    android:layout_height
    ="wrap_content"

    android:background
    ="#ffffff"

    android:layout_below
    ="@id/label"

    />

    <Button android:id="@+id/btnOk"

    android:layout_width
    ="wrap_content"

    android:layout_height
    ="wrap_content"

    android:layout_below
    ="@id/txt"

    android:layout_alignParentRight
    ="true"

    android:layout_marginLeft
    ="10dip"

    android:text
    ="√"/>

    <Button android:id="@+id/btnCancel"

    android:layout_width
    ="wrap_content"

    android:layout_height
    ="wrap_content"

    android:layout_alignParentBottom
    ="true"

    android:layout_alignParentLeft
    ="true"

    android:layout_alignBaseline
    ="@id/btnOk"

    android:layout_toLeftOf
    ="@id/btnOk"

    android:layout_alignWithParentIfMissing
    ="true"

    android:text
    ="X"/>
    </RelativeLayout>

            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.main);
    
            Button btn = (Button)findViewById(R.id.btnOk);
    
            btn.setOnClickListener(newView.OnClickListener() {
    
               public void onClick(View v) {
    
                  v.setVisibility(View.GONE);
    
               }
           });
    

    当值为true的时候点击后的效果

    当设为false的时候

  • 相关阅读:
    vb学习笔记
    spfa模版
    spfa slf优化
    接口总结
    SAP屏幕穿透
    判断可编辑字段,用户输入的数据是否为纯数字(包含带小数点的小数)
    对于ALV中的可编辑字段,当输入的数据不满足某种条件时,我们需要将它恢复到修改前的数据,并刷新ALV。但是可编辑的字段刷新后仍然时修改后的数据,此处记录一种方法。
    ALV中可编辑字段数据变化时,对变化的数据进行操作。
    通过UPDATE 往数据库中更新数据
    SE16N 中设置为可编辑状态
  • 原文地址:https://www.cnblogs.com/hawkon/p/1806226.html
Copyright © 2011-2022 走看看