Ich habe vor kurzem beschlossen, meine App auf die neue Support-Design-Bibliothek zu verschieben, und vor kurzem einen sehr bösen Bug entdeckt.CoordinatorLayout mit CollapsingToolbarLayout bricht mit Tastatur im Dialog Fragment
Angenommen, ich habe ein CoordinatorLayout, das ein AppBarLayout und eine scrollbare Ansicht hostet, sei es ein ViewPager, NestedScrollView oder sogar ein RecyclerView mit dem erforderlichen Scroll-Verhalten; Wenn Sie ein Dialogfeldfragment anzeigen, das die Tastatur anzeigt, wird die Verbindung zwischen AppBarLayout und der Scroll-Ansicht aufgehoben, und sie scrollen nicht mehr zusammen.
Darüber hinaus ist die Scroll-Ansicht gezwungen, die Größe auf die Hälfte des Bildschirms am unteren Rand zu ändern, und das AppBar-Layout nimmt die obere Hälfte, obwohl es nicht benötigt wird.
Ein Video des Fehlers ist hier: Youtube Link
EDIT:
in der Aktivität der die softInputMode der Tastatur Einstellung "adjustPan" das Problem behebt. Anscheinend möchte das CoordinatorLayout nicht dynamisch von der Tastatur skaliert werden.
Der fehlbare XML sieht so aus, aber ich habe mehrere XML-Variationen, die dieses Verhalten zeigen, mit dem gemeinsamen Element unter ihnen allen sie ein CollapsingToolbarLayout verwenden sein: auf Ihr Android
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="192dp"
android:background="@color/transparent">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="144dp"
android:elevation="4dp"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="@dimen/quadruple_margin"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="@color/primary"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/ranking_background" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_gravity="bottom"
android:background="@color/black_40" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_picture"
android:layout_width="@dimen/double_margin"
android:layout_height="@dimen/double_margin"
android:layout_alignBottom="@+id/text"
android:layout_marginLeft="@dimen/double_margin"
android:layout_marginStart="@dimen/double_margin"
android:src="@drawable/image_placeholder"
android:visibility="gone" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_marginLeft="@dimen/single_margin"
android:layout_marginStart="@dimen/single_margin"
android:layout_marginTop="@dimen/quadruple_margin"
android:layout_toRightOf="@+id/profile_picture"
android:text="@string/my_places_for"
android:textColor="@color/white"
android:textSize="20sp"
android:visibility="gone" />
<TextView
android:id="@+id/sub_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/text"
android:layout_marginLeft="@dimen/single_margin"
android:layout_marginStart="@dimen/single_margin"
android:layout_marginTop="@dimen/single_margin"
android:text="@string/pick_category_or_business"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/action_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/abc_action_bar_default_height_material"
app:contentInsetLeft="@dimen/triple_margin"
app:contentInsetStart="@dimen/triple_margin"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.AppCompat.NoActionBar"
app:theme="@style/Theme.AppCompat.NoActionBar" />
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
app:layout_scrollFlags="scroll">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:background="@color/primary"
android:elevation="4dp"
app:layout_scrollFlags="enterAlways"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/white"
app:tabTextColor="@color/grey_400" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
perfekte Jungs! Danke vielmals ! – anthony