Olá
Estou com um problema na minha app que ao usar as preferências o layout das preferências está por cima da minha toolbar
Este é o código
'<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools=“http://schemas.android.com/tools"
android:id=”@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer=“start”>
<include
android:id="@+id/app_bar"
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/content"
android:layout_below="@id/app_bar"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
`
Que como se vê inclui este xml´
`<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height=“match_parent"
android:fitsSystemWindows=“true"
tools:context=”.MainActivity”>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:navigationIcon="?attr/homeAsUpIndicator"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include
layout="@layout/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:layout_marginTop="?attr/actionBarSize" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_partial_secure" />
</android.support.design.widget.CoordinatorLayout>'
e este inclui este
’<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="@+id/location"
android:paddingTop="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>'
As minhas prefrencias estão num ficheiro xml na pasta xml
<?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:summary="Username and password information" android:title="Informações de Login"> <EditTextPreference android:key="username" android:summary="Introduzir username" android:title="Username" /> <EditTextPreference android:key="password" android:summary="Introduzir password" android:title="Password" /> </PreferenceCategory> <PreferenceCategory android:summary="sessao" android:title="Definições"> <Preference android:key="@string/myCoolButton" android:summary="Mude aqui" android:title="Mudar a password na BD" /> <CheckBoxPreference android:key="checkBox" android:summary="On/Off" android:title="Manter Sessão" /> </PreferenceCategory> </PreferenceScreen>
E o meu layout está assim