10

집/위로 단추가있는 축소 도구 모음을 사용하려고합니다. 툴바가 무너지면 화살표와 제목 텍스트 사이에 공백이 생겨서 제거하고 싶습니다. 내 요점을 설명하기 위해 레이아웃 경계가 있거나없는 두 개의 이미지를 첨부했습니다.접음 도구 모음 제목과 집/위 버튼 사이의 여유 공간

나는 StackOverflow를 도처에서 조사하여 android : contentInsetStart = "0dp" 을 헛되이 시도했습니다.

enter image description here

enter image description here

여기 내 레이아웃 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:orientation="vertical"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:background="?colorPrimary" 
     app:elevation="4dp"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="?attr/colorPrimary" 
      app:collapsedTitleTextAppearance= 
       "@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse" 
      app:contentScrim="?attr/colorPrimary" 
      app:expandedTitleTextAppearance= 
       "@style/TextAppearance.ExpandedTitle" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed" 
      app:title="Toolbar Title"> 


      <ImageView 
       android:id="@+id/collapsing_toolbar_background" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="88dp" 
       android:contentDescription="@string/app_name" 
       android:scaleType="centerCrop" 
       android:src="@drawable/glider" 
       app:layout_collapseMode="parallax" 
       /> 

      <View 
       android:id="@+id/toolbar_title_scrim" 
       android:layout_width="match_parent" 
       android:layout_height="100dp" 
       android:layout_alignBottom="@+id/collapsing_toolbar_background" 
       android:layout_gravity="bottom" 
       android:background="@android:color/holo_green_light"/> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" 
       android:text="test text" 
       android:textColor="@android:color/white"/> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:contentInsetStart="0dp" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
       app:layout_collapseMode="pin"/> 

     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipe_refresh_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recycler_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:clipToPadding="false" 
      android:paddingBottom="16dp" 
      android:paddingLeft="16dp" 
      android:paddingRight="16dp" 
      android:scrollbarStyle="outsideOverlay"/> 
    </android.support.v4.widget.SwipeRefreshLayout> 

</android.support.design.widget.CoordinatorLayout> 

답변

16

이것은 디자인 라이브러리 버전 24에서 소개 된 새로운 재질 디자인 사양의 일부인 것으로 밝혀졌습니다.

https://material.google.com/patterns/navigation.html

그러나, 위젯 툴바에 다음과 같은 속성을 추가하여 여분의 공간을 제거 할 수 있습니다.

app:contentInsetStartWithNavigation="0dp" 
+0

이 답변은 저에게 잘 맞았습니다 !! :) – Aakash

+0

매력처럼 작동합니다. 정말 고맙습니다! –