Maju Sumanto
Maju Sumanto

Reputation: 11

Customize setting activity in android (preference)

i used template of Settings activity (preference) in android studio but i have this layout.my XML

but i want the layout look like this new XML

and i finished create the top bar"help" with photoshop, how to add the top bar "help" like my customize layout? Thx.

And this is my code (pref_headers.xml):

<header
    android:fragment="com.example.hp.refomandaapps.SettingsActivity$NotificationPreferenceFragment"
    android:icon="@drawable/ic_notifications_black_24dp"
    android:title="@string/pref_header_notifications" />

<header
    android:fragment="com.example.hp.refomandaapps.SettingsActivity$DataSyncPreferenceFragment"
    android:icon="@drawable/ic_sync_black_24dp"
    android:title="@string/pref_header_data_sync" />

Upvotes: 0

Views: 986

Answers (1)

h_patel
h_patel

Reputation: 744

add this at the top .

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#000">


<TextView
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:gravity="center"
    android:text="Title"
    android:id="@+id/tv_title"
    android:textSize="8.5pt"
    android:textColor="@color/colorWhite"
    android:layout_centerHorizontal="true"/>

 </RelativeLayout>

Upvotes: 1

Related Questions