android - Inheriting from AppCompat Toolbar changes Toolbar icon margin -


in project i'm extending android.support.v7.widget.toolbar add functionality class. however, when implement class in layout file changes margin (or padding, not sure...) of icons displayed on toolbar.

default android.support.v7.widget.toolbar result:

android.support.v7.widget.toolbar

custom toolbar class result:

custom toolbar

my custom toolbar class has no code yet, implements required constructors, i'm not manipulating margin myself.

here's custom toolbar class:

import android.content.context; import android.support.annotation.nullable; import android.support.v7.widget.toolbar; import android.util.attributeset;   public class themedtoolbar extends toolbar {      public themedtoolbar(context context) {         this(context, null);     }      public themedtoolbar(context context, @nullable attributeset attrs) {         this(context, attrs, 0);     }      public themedtoolbar(context context, @nullable attributeset attrs, int defstyleattr) {         super(context, attrs, defstyleattr);     } } 

and here's toolbar layout file i'm including in activities:

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android"              android:layout_width="match_parent"              android:layout_height="?actionbarsize">      <com.endare.ui.theme.view.themedtoolbar         android:id="@+id/toolbar_control"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="@android:color/white" />      <relativelayout         android:id="@+id/toolbar_content_container"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="horizontal">          <imageview             android:id="@+id/toolbar_logo"             android:layout_width="wrap_content"             android:layout_height="match_parent"             android:layout_centerinparent="true"             android:layout_marginbottom="5dp"             android:layout_margintop="5dp"/>      </relativelayout>  </framelayout> 

so basically, did in layout file see different results switching <android.support.v7.widget.toolbar <com.endare.ui.theme.view.themedtoolbar.

how can prevent custom toolbar implementation of changing margin of icons?


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -