.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>




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

posted @ 2015-07-17 19:30  blfshiye  阅读(244)  评论(0编辑  收藏  举报