4

I have preference menu in my app. I am using Android 1.6. I wanted to use a static save button at the bottom of the screen.

I know how to do it with Relative Layout using android:layout_alignParentBottom="true"

    <Button
    android:id="@id/preferencesSaveButton"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="10dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="10dp"
    android:padding="15dp"
    android:text="Save"
    android:textStyle="bold" />

Can we use preference inside Relative Layout or is there any other practical method to do it?

Vivek Kalkur
  • 2,200
  • 2
  • 21
  • 40
Antu
  • 523
  • 8
  • 18

1 Answers1

2

you can use preference activity in tabbed layout and that would be a practical method for your query. Tabbed Layout should be having a relative layout.. In one of the tabhost, you can use preference activity through a intent.. that looks cool. I don't think so you need a save button in preference.. it automatically saves the preference and shared across if you have preference activity..

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

    <TabHost android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@android:id/tabhost"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <RelativeLayout
  android:layout_height="fill_parent"
  android:layout_width="fill_parent">

  <FrameLayout
    android:id="@android:id/tabcontent"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@android:id/tabs"
    android:padding="5dp" />

  <TabWidget
    android:id="@android:id/tabs"
    android:layout_alignParentBottom="true"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
</RelativeLayout>
    </TabHost>
Sanjay Herle
  • 313
  • 2
  • 4
  • 15