Meine Haupttätigkeit hat eine Toolbar in einem AppBarLayout und ein unter dem gehören:inklusive Layout deckt Eltern Layout
<?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="com.zhephyr.somedaytoday.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="?attr/actionBarSize"
android:background="?attr/colorPrimaryDark"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/activity_chrono_tab"/>
</android.support.design.widget.CoordinatorLayout>
Die mitgelieferte Layout ist ein RelativeLayout mit einem TabLayout zu einem ViewPager verbunden:
<?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"
tools:context=".ChronoSwipeViewActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorVariant"
android:weightSum="1">
<android.support.design.widget.TabLayout
android:id="@+id/chrono_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:tabMode="fixed"
android:background="@color/colorVariant"/>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@android:drawable/ic_dialog_email"
android:layout_margin="@dimen/fab_margin"
app:fabSize="normal"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"/>
<android.support.v4.view.ViewPager
android:id="@+id/chrono_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tabs" />
</RelativeLayout>
Das Problem, auf das ich gerade stoße, ist, dass das enthaltene Layout über meinem Hauptlayout sitzt und den gesamten Bildschirm ausfüllt. Ich kann die Toolbar nicht sehen, weil sie abgedeckt ist. Ich möchte, dass das enthaltene Layout nur den Bereich unter der Symbolleiste ausfüllt. Ich habe versucht, app:layout_behavior="@string/appbar_scrolling_view_behavior"
in beiden Layouts und im Include ohne Erfolg zu platzieren. Wer weiß was los ist?
aktualisieren
Die Aktivität ist dies dargestellt ist:
sollte innerhalb dieser und mit aus dem App-Titel angezeigt Diese Aktivität:
Ändern Sie die Wurzel Ihres enthalten Layout 'android sind: layout_height = "wrap_content"' – codeMagic
Da CoordinatorLayout ist intern FrameLayout. Das Attribut "match_parent" des enthaltenen Layouts wird darüber eingefügt. – Vinodh