• XML布局之路


    XML布局存放在工程文件的res/layout目录下。安卓和PC端的界面布局有用到。

    常用的布局方式,线性布局:LinearLayout

                                表格布局:TableLayout

                                 帧布局  :FrameLayou

                                 绝对布局:AbsoluteLayout 

                                 相对布局:RelativeLayout

     1 <LinearLayout
     2     xmlns=“http://域名/xWindow/layout”
     3     xmlns:amdroid="http:/域名/xWindow/android"
     4     android:layout_width="match_patent"
     5     android:layout_height="warp_parent
     6     android:paddingLeft="12dp"
     7     android:clickable="true"
     8     android:gravity="center_vertical">
     9 <ImageView
    10     android:id="1"
    11     android:layout_width="1"
    12     android:layout_heigth="1"
    13     android:style="RoundBackgroundStyle">
    14 <HoverPressedBackgroundHandler
    15     android:normal = "XXX.png"
    16     android:hover = "XXX.png"
    17     android:pressed = "XXX.png"/>
    18 <HoverTipHandler android:TipText =  "1111"/>
    19 <1BtnHandler/>
    20 </ImageView>
    21 <ImageView
    22     android:id="2"
    23     android:layout_width="2"
    24     android:layout_heigth="2"
    25     android:style="RoundBackgroundStyle">
    26 <HoverPressedBackgroundHandler
    27     android:normal = "XXX.png"
    28     android:hover = "XXX.png"
    29     android:pressed = "XXX.png"/>
    30 <HoverTipHandler android:TipText =  "2222"/>
    31 <2BtnHandler/>        
    32 </ImageView>
    33 </LinearLayout>

    match_parent和warp_parent的区别是:match_parent是自动填满和fill_parent的功能是一样的,warp_parent是根据需要填充的内容的变化,来确定大小。

    paddingLeft和layout_marginLeft的区别是:layout_marginLeft实在整个布局的左边界,paddingLeft是布局里的左边界距离。

    代码的14-17行是正常显示,鼠标悬浮,以及点击三态的显示。

    HoverTipHandler是鼠标进入后的悬浮显示

    <1BtnHandler>触发上面的点击事件,用这个handler来显示次级菜单栏,或者说是,显示另一个界面布局。这个handler可以继承xViewHandler。重写虚函数。

    定义一个xView类型的指针, m_p = &m_pHostView->vIewAt<xView>("1"),根据id取出对象,然后,通过封装好的SLOT_CONNECT(),将这个按钮与槽函数绑定上。

  • 相关阅读:
    二叉树解题思想
    SpringBoot + Mybatis 和ssm 使用数据库的区别
    Spring Cache 抽象(缓存抽象) Redis 缓存
    VirtualBox 虚拟机 从入门到入坑
    小知识点的记录
    SpringBoot 的不同
    请你激起学习的激情
    java 适配器模式
    UML类图的情话诉说
    Java 工厂模式
  • 原文地址:https://www.cnblogs.com/132818Creator/p/7115638.html
Copyright © 2020-2023  润新知