• .Net程序猿乐Android发展---(10)框架布局FrameLayout


                        帧布局FrameLayout中全部的控件都在界面的左上側,后绘制的空间会覆盖之前的控件。布局内控件以层叠方式显示,用在游戏开发方面可能多些.


                  1.层叠展示

                    以下这个样例中,3个textview以层叠方式显示,通过大小和颜色我们来展示下这3个控件的层叠方式
     
                        
    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
      
       <TextView
            android:layout_width="300dp"
            android:layout_height="300dp"
            android:text="游响云停工作室"
            android:gravity="center"
            android:background="#FFE4B5"
             />
        
           <TextView
            android:id="@+id/textView1"
            android:layout_width="150dp"
            android:layout_height="120dp"
            android:text="游响云停工作室"
            android:gravity="center"
            android:background="#D1EEEE"
             />
           
              <TextView
            android:layout_width="100dp"
            android:layout_height="50dp"
            android:text="游响云停工作室"
            android:gravity="center"
            android:background="#EEB422"
             />
     
    </FrameLayout>
    


                     2.商品列表演示样例

       

    <?

    xml version="1.0" encoding="utf-8"?

    > <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/imageView1" android:layout_width="100dp" android:layout_height="100dp" android:src="@raw/pad" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="商品名称:Ipad Air" android:layout_marginLeft="120dp" android:layout_marginTop="10dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="商品金额:$20" android:layout_marginLeft="120dp" android:layout_marginTop="40dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="商品颜色:白色" android:layout_marginLeft="120dp" android:layout_marginTop="70dp" /> <TextView android:layout_width="fill_parent" android:layout_height="3dp" android:text="" android:layout_marginLeft="0dp" android:layout_marginTop="110dp" android:background="#D1EEEE" /> <ImageView android:id="@+id/imageView2" android:layout_width="100dp" android:layout_height="100dp" android:layout_marginTop="120dp" android:src="@raw/pad" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="商品名称:Ipad Air" android:layout_marginLeft="120dp" android:layout_marginTop="140dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="商品金额:$20" android:layout_marginLeft="120dp" android:layout_marginTop="170dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="商品颜色:白色" android:layout_marginLeft="120dp" android:layout_marginTop="200dp" /> <TextView android:layout_width="fill_parent" android:layout_height="3dp" android:text="" android:layout_marginLeft="0dp" android:layout_marginTop="220dp" android:background="#D1EEEE" /> </FrameLayout>


    

    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    第三章函数
    基本数据类型
    gulp压缩js
    read/load
    jQuery的类数组对象结构
    立即调用表达式
    npm
    cocos2d.js
    图片上传后压缩 Thinkphp
    判断用户是否在微信中
  • 原文地址:https://www.cnblogs.com/blfshiye/p/4655492.html
Copyright © 2020-2023  润新知