2017-02-14 3 views
2

이미지가 로고 인 툴바가 있으며 로고가 중앙에 있습니다. 그러나 내비게이션 서랍을 넣으면 내비게이션 서랍 버튼이 있기 때문에 로고가 오른쪽으로 이동했습니다. 툴바의 탐색 서랍 버튼을 중심으로 로고를 중앙에 배치하는 방법은 무엇입니까?안드로이드 툴바 이미지 네비게이션 서랍 버튼을 중심으로

감사합니다.

내 코드

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="25dp" 
       android:src="@drawable/logo"/> 

    </android.support.v7.widget.Toolbar> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="?attr/colorPrimaryDark" 
     app:tabGravity="fill" 
     app:tabMode="fixed" /> 

</android.support.design.widget.AppBarLayout> 
+0

0은 ... UI가 –

답변

1

사용 안드로이드 : contentInsetLeft = "0dp" 또는 안드로이드는 : 도구 모음

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:background="?attr/colorPrimary" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
    android:contentInsetLeft="0dp"> 
+0

로 건포도 출력을 게시 이미지 뷰와 체크에서 – user3851241

+0

항상 '클린 & 다시 빌드를'작동 중력 요소를 추가하지 않는 이미지 – Pehlaj

1

이 레이아웃 시도와 contentInsetStart = "0dp"android:layout_gravity="center_horizontal"를 추가 Imageview

+0

toobar – user3851241

+0

도구 모음 위젯 내부의 구성 요소에는 layout_gravity 그것이 없습니다했다 자신의 LayoutParams을 변경 한 후 – rafsanahmad007

관련 문제