Couston TextViewNormal set font

Custom text view set font

* first of all assest folder paste font



import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;



public class TextViewNormal extends TextView {


    public TextViewNormal(Context context) {
        super(context);
        init();
       /* Typeface face=Typeface.createFromAsset(context.getAssets(), "helvetica_neue_lt_pro.otf");        this.setTypeface(face);*/    }

    public TextViewNormal(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public TextViewNormal(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

   
    private void init() {
        Typeface face=Typeface.createFromAsset(getContext().getAssets(), "helvetica_neue_lt_pro.otf");
        this.setTypeface(face);
    }
}

______________________________________________________________________


<com.view.TextViewNormal 
    android:layout_width="wrap_content"    android:layout_height="wrap_content"     />
Share:

No comments:

Post a Comment

Powered by Blogger.

Recent Posts

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.