0

As the android document suggest, I have set the logo in toolbar. Refer: toolBar.setLogo

Is there any way to change the width of toolbar logo?

Ashish John
  • 1,867
  • 2
  • 23
  • 38
  • this should help you --> https://stackoverflow.com/a/38202628/12553303 – Wini Jul 16 '20 at 07:03
  • @Wini The reference shared by you is updating the homeButton drawable with custom one. I am using setLogo method which is similar to set title where we set string as title. – Ashish John Jul 17 '20 at 11:23
  • so you still havent found solution or still looking? – Wini Jul 17 '20 at 11:24
  • have you went through this--> https://stackoverflow.com/questions/27135685/appcompat-v21-toolbar-changing-logo-size – Wini Jul 17 '20 at 11:33
  • @Wini Right now I have resized the logo for a better view, but the problem is, it looks fine in phone but then little variation for tablets. Still finding the solution. The 2nd link you have provided is also having the a customized toolbar. – Ashish John Jul 18 '20 at 00:49

1 Answers1

0

Customize toolbar by creating child views inside toolbar

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_top"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/action_bar_bkgnd"
app:theme="@style/ToolBarTheme" >


 <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
     >

     <ImageView
       android:layout_width="200dp"
       android:layout_height="wrap_content"
       android:src="@drawable/yourlogo"
     >

 </RelativeLayout>


</android.support.v7.widget.Toolbar>
Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159