Wie kann ich dieses Problem beheben? Hier ist der Bildschirm: Warum dieses Textfeld und appbar überlappen?
Das ist mein XML-Fragment:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Utenti.Profilo.ProfiloFragment">
<TextView
android:text="IL TUO PROFILO"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView3"
android:textStyle="normal|bold"
android:textSize="24sp"
android:layout_weight="1"
android:fontFamily="serif"
android:lineSpacingExtra="10sp"
android:textAllCaps="false"
android:gravity="center_horizontal"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true" />
<TextView
android:text="Le tue stanze:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView3"
android:layout_alignParentStart="true"
android:layout_marginStart="14dp"
android:layout_marginTop="28dp"
android:id="@+id/tue_stanze"
android:textStyle="normal|italic"
android:textSize="18sp" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tue_stanze"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp" />
Ich benutze eine Navigationsleiste für das erste Mal und ich brauche Fragment zu schaffen für das Menü zu verwenden.
tnks für Hilfe.
EDIT: Das ist mein content_main xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.bfco.bocci.androhouse.MainActivity"
tools:showIn="@layout/app_bar_main">
EDIT2: Ich habe dieses "app_bar_main.xml" verwenden, die content_main umfassen:
<?xml version="1.0" encoding="utf-8"?>
<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="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<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_dialog_email" />
Und das ist mein main.xml:
<?xml version="1.0" encoding="utf-8"?>
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/frame_container"
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" />
Können Sie den Hauptlayout-XML-Code einfügen. Das Layout, das die Navigationsleiste und den Container enthält? –
Verwenden Sie 'getSupportActionBar(). SetDisplayShowTitleEnabled (false);' Dann ist dieser weiße Titel verschwunden, was der Name Ihrer App ist –
Fügen Sie dieses Attribut 'app: layout_behavior = "@ string/appbar_scrolling_view_behavior">' in Ihrem Fragment-Container des Hauptlayouts xml hinzu ich dinge das wird dein problem lösen – saeed