Monday, March 15, 2021

이미지 로고 타이틀 Toolbar 센터에 위치 시키기

 



Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);


<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.Temp.AppBarOverlay">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.Temp.PopupOverlay" >
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="165dp"
android:layout_height="wrap_content"
android:src="@drawable/toolbar_title"
android:layout_gravity="center"/>
</androidx.appcompat.widget.Toolbar>

</com.google.android.material.appbar.AppBarLayout>