there is whitespace in the bottom side of search .please check the Screenshot. sorry for my English. I provided Screenshot for better understanding.
help me to solve this problem.
Main Activity XML
<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.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffe5e5e5"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="@layout/card_layout" />
<include layout="@layout/card_layout" />
<include layout="@layout/card_layout" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="?attr/actionBarSize"
android:elevation="0dp"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="25dp"
android:background="@drawable/ic_menu" />
<TextView
android:layout_width="80dp"
android:layout_height="25dp"
android:layout_marginLeft="0dp"
android:gravity="center"
android:text="FlipKart"
android:textColor="@android:color/white"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageviewCircle"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="end"
android:layout_marginLeft="100dp"
android:background="@drawable/circle" />
<ImageView
android:id="@+id/imageviewBell"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginLeft="100dp"
android:background="@drawable/ic_bell" />
</RelativeLayout>
<ImageView
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginLeft="10dp"
android:background="@drawable/ic_cart" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="80dp"
android:background="@drawable/rounded_edittext"
android:elevation="0dp"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|enterAlways">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:orientation="horizontal"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ImageView
android:id="@+id/imageviewSearch"
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/ic_magnify" />
<TextView
android:id="@+id/textviewSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="3dp"
android:cursorVisible="true"
android:editable="true"
android:elevation="0dp"
android:hint="Search for products,Brands "
android:textColorHint="@android:color/darker_gray" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Hello, everyone. I have provided a snip of my XML file. Since I am a noob, I'm requesting the StackOverflow army for help.
Thanks a lot for helping me out.
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
You have hardcoded the height of AppBarLayout
, so obviously it will always be 250dp everytime. Adjust that value to get proper height
.
Try using wrap content for both CollapsingToolbarLayout and AppBarLayout, if it doesnt work then try using 120dp to 150dp values for AppBarLayout and match_parent for CollapsingToolbar
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.