FrameLayout

Source code in FrameLayout.zip

  1. FrameLayoutActivity.java
  2. main.xml
  3. AndroidManifest.xml

The simplest type of layout is a FrameLayout, which jams all of its views into its upper left corner. FrameLayout does not have the android:orientation attribute that LinearLayout has. We’ll program fast and dirty and not use the strings.xml file. Dimension units: 72 points = 1 inch. I should have used scale-independent pixels. FF0000FF is opaque blue; FFFFFFFF is opaque white. Newline character \n before ALBANY.

A FrameLayout will be used in a TabLayout here.

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

<FrameLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
>

	<TextView
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:text="HOLIDAY INN"
		android:textSize="34pt"
		android:textColor="#FF0000FF"
	/>

	<TextView
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:text="\nALBANY"
		android:textSize="12pt"
		android:textColor="#FFFFFFFF"
	/>

</FrameLayout>

Launch the app in landscape orientation

Add the following attribute to the activity tag in AndroidManifest.xml. Press 7 and 9 on your computer’s numeric keypad to rotate the emulator.

android:screenOrientation="landscape"