How to Merge CustomFont Class with Material design Libary
<h1>My Custom Button that i'll use in my xml file:</h1>

<p>i want to custom a button with shape of Rectangle(from Material Design library)
and adding a custom font to it.</p>

<p>this is what i come up with:</p>

<pre><code>import com.gc.materialdesign.views.ButtonRectangle;

public class FontCustomButton extends Button {

 public FontCustomButton(Context context, AttributeSet attrs) {
    super(context, attrs);

    MyButton myButton = new MyButton(context,attrs);
    Typeface typeface =  myButton.getFont(context);
    this.setTypeface(typeface);
 }

  //inner class
  public class MyButton extends ButtonRectangle{
    public MyButton(Context context) {
        super(context, attrs);

  }

        //this Method will return my font as TypeFace
        public Typeface getFont(Context context){

            Typeface face=Typeface.createFromAsset(context.getAssets(),"fonts/font_1.ttf");
            return face;
        }
  }

}
</code></pre>

<p>and here is how i want it to be called:</p>

<pre><code> &lt;FontCustomButton 
        android:layout_width="140dp"
        android:layout_height="60dp"
        android:text="@string/log_in"
        android:id="@+id/btn_login"
         /&gt;
</code></pre>

<p>now my button should have the shape of Rectangle and the font at the same time.</p>

<p>link for the Material Design library that i use:</p>

<p><a href="https://github.com/navasmdc/MaterialDesignLibrary" rel="nofollow">https://github.com/navasmdc/MaterialDesignLibrary</a></p>