2017-12-20 40 views
0

[Android : 헤더의 활동을 헤더에 표시하고 머리글 왼쪽에 장소 메뉴를 표시하고 싶습니다. 누군가가이를 구현하는 방법을 도울 수 있습니다. 첨부 된 스크린 샷을 참조하십시오. 링크가 도움이된다면.Android - 서랍 메뉴로 활동중인 헤더의 로고

덕분에 ] 1

+1

[중심 툴바 화상]의 가능한 복제 (https://stackoverflow.com/questions/27534343/toolbar-image-centered) – ADM

+0

https://medium.com/@janishar.ali/navigation-drawer -android-example-8dfe38c66f59 – Rainmaker

+0

제안에 감사드립니다. – John

답변

0

을보십시오. 하위 이미지보기 태그에 android : layout_gravity = "center"를 추가해야합니다.

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/colorPrimary"> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_person" 
     android:layout_gravity="center" 
     /> 

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

제안 해 주셔서 감사합니다. 어떻게 이미지를 프로그래밍 방식으로 설정할 수 있습니까? – John

+0

프로그래밍 방식으로 처리했습니다. – John

+1

툴바 toolbar = (툴바) findViewById (R.id.toolbar); ImageView img = toolbar.findViewById (R.id.logo); img.setImageResource (R.mipmap.logo); – John