Deepu Mandy
Deepu Mandy

Reputation: 117

i want to fix an home button for all activities.how?

i am designing an application which have diff types of functionalies through buttons/image buttons. At final the list might increase. i want to put one custom home button which always keeps on screen when i am in diff activities. or either if you have any idea about how this Home button is coded to this layout below screen. please help.

enter image description here

Upvotes: 0

Views: 786

Answers (4)

FrankkieNL
FrankkieNL

Reputation: 731

Make a layout with a ScrollView on top, and your image-button below the scrollview.
Example:

<!-- language: lang-xml -->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
  <ScrollView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Your Content Here"
    />
  </ScrollView>
  <LinearLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content">
    <ImageView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher"
    />
  </LinearLayout>
</LinearLayout>

It looks like this:
Screenshot

Upvotes: 0

Mukund Samant
Mukund Samant

Reputation: 1089

While the home button at the bottom can be easily achieved using an image view/button,Using an action Bar is the recommended option.Not only can you link with the home activity but also any other activity of your choice.Refer this to gain a deeper insight.

http://developer.android.com/guide/topics/ui/actionbar.html

http://developer.android.com/reference/android/app/ActionBar.html

Upvotes: 1

Vikram Bodicherla
Vikram Bodicherla

Reputation: 7123

Have you considered the Action Bar which is exactly designed for this purpose? http://developer.android.com/guide/topics/ui/actionbar.html

Upvotes: 1

Krishnakant Dalal
Krishnakant Dalal

Reputation: 3578

You can either place a button/image button/image anything in xml layout and set on click listener on that component. You can also use option menu and give multiple option on all the screens of your application.

Upvotes: 0

Related Questions