0

검색의 하단에 공백이 있습니다. 화면 캡처를 확인하십시오. 미안하다. 더 나은 이해를 위해 스크린 샷을 제공했습니다. 축소 도구 모음의 아래 공백을 제거하는 방법?

Screenshot 1

Screenshot 2

도움이 내게는이 문제를 해결합니다.

주요 활동의 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> 

안녕하세요, 여러분. XML 파일을 잘라 냈습니다. 나는 멍청이이기 때문에 StackOverflow 군대에게 도움을 요청하고 있습니다.

나를 도와 주셔서 감사합니다.

답변

0
<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" 

당신은 AppBarLayout의 높이를 하드 코딩, 그래서 분명히 항상 250dp 매번 될 것입니다. 올바른 값을 얻으려면이 값을 조정하십시오. height. 그 다음 작업 CollapsingToolbar

에 대한 AppBarLayout 및 match_parent 값을 150dp하는 120dp를 사용하려고 나던 경우

것은 CollapsingToolbarLayout 및 AppBarLayout 모두 랩의 콘텐츠를 사용해보십시오