Using relative layout in the preferences menu

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

I know how to do this with Relative Layout with 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 preferences inside the Relative Layout or is there another practical method for this?

+4
source share
1 answer

you can use preference activity in a tabbed layout and this will be a practical method for your request. A tab with tabs should have a relative layout. In one of the tails, you can use preference activity through intent .. it looks cool. I don’t think you need a save button. It automatically saves preferences and shares 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> 
+2
source

Source: https://habr.com/ru/post/1384831/


All Articles