Creating simple interface

copy the following code in UserInterface class file in src folder


package chapter.seven;

import android.app.Activity;
import android.os.Bundle;

public class UserInterface extends Activity {
    /** Called when the activity is first created. */
    @Override
    //seee pg 117-120
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}


Copy the following code in main.xml file in Layout folder

Main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
<!-- creating image button see pg 120 -->
    <ImageButton
        android:id="@+id/button_one"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/button1s"
        android:paddingTop="5px"
         />
</LinearLayout>

Copy the following code creating a file in drawable  folder called  button1s.xml

button.xml


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:state_pressed="true"
          android:drawable="@drawable/button1_pressed"
        />
<item
   android:state_focused="true"
   android:drawable="@drawable/button1_focused"
   />
<item
   android:drawable="@drawable/button1_normal"
   />
</selector>