Tuesday, 3 January 2012

FrameLayout


FrameLayout is designed to display a single item at a time. You can have multiple elements within a FrameLayout but each element will be positioned based on the top left of the screen. Elements that overlap will be displayed overlapping. I have created a simple XML layout using FrameLayout that shows how this works.
<FrameLayout 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         xmlns:android="http://schemas.android.com/apk/res/android">
         <ImageView 
                 android:src="@drawable/icon"
                 android:scaleType="fitCenter"
                 android:layout_height="fill_parent"
                 android:layout_width="fill_parent"/>
         <TextView
                 android:text="android-guide-sss.blogspot.com"
                 android:textSize="24sp"
                 android:textColor="#000000"
                 android:layout_height="fill_parent"
                 android:layout_width="fill_parent"
                 android:gravity="center"/>
</FrameLayout>
Here is the result of this XML.


No comments:

Post a Comment