Ich habe eine einfache Aktivität mit einer CollapsingToolbar
. Lassen Sie mich Ihnen zeigen, was ich habe 1. und dann erklären, was das Problem ist!Warum ist meine Schaltfläche versteckt, wenn ich CollapsingToolbar verwende
Wenn die Werkzeugleiste ausgeblendet ist (links) vs wenn es erweitert wird (rechts)
Wie Sie sehen können, ist die Search button
nicht zeigen, wenn die Symbolleiste erweitert wird . Wie kann ich das beheben?
activity_search.xml:
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include
layout="@layout/content_search" />
</android.support.design.widget.CoordinatorLayout>
content_search.xml
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ll"
android:layout_alignParentTop="true"
android:layout_marginBottom="@dimen/view_margin"
android:orientation="horizontal">
<AutoCompleteTextView
android:id="@+id/etIngredients"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<ImageButton
android:id="@+id/btAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add"/>
</LinearLayout>
<Button
android:id="@+id/btSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/search"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvIngredients"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/btSearch"
android:layout_below="@id/ll"/>
</RelativeLayout>
Ich habe versucht, für diese Frage suchen, aber could'nt überhaupt etwas finden!
Macht Sinn! Ich werde das versuchen, wenn ich zurück zu meinem PC komme. Danke –
Danke. Das hat funktioniert! :) –
Dein Willkommen :) – Neo