Frame layout is a placeholder on the screen. Child views are placed as stack, with most recent one at the top. For placing views adjacent to each other, Linear and Relative layouts are used. For stacking items, such as text view on top of image view, frame layout is used.
Replace my_picture in the activity_main.xml, with the picture you add in the drawable folder.
MainActivity.javaactivity_main.xml
package com.zyasin.framelayout; import android.os.Bundle; import android.app.Activity; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView android:src="@android:drawable/my_picture" android:scaleType="fitCenter" android:layout_height="fill_parent" android:layout_width="fill_parent"/> <TextView android:text="zyasin.com" android:textSize="24sp" android:textColor="#ffff" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center"/> </FrameLayout>