Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. package com.gosigap.masyarakat.customview.customfonts;
  2.  
  3. import android.annotation.SuppressLint;
  4. import android.content.Context;
  5. import android.graphics.Typeface;
  6. import android.util.AttributeSet;
  7. import android.widget.TextView;
  8.  
  9. /**
  10. * Created by macbookpro on 1/18/17.
  11. */
  12.  
  13. @SuppressLint("AppCompatCustomView")
  14. public class MyTextViewOpenSansLight extends TextView {
  15. public MyTextViewOpenSansLight(Context context) {
  16. super(context);
  17. init();
  18. }
  19.  
  20. public MyTextViewOpenSansLight(Context context, AttributeSet attrs) {
  21. super(context, attrs);
  22. init();
  23. }
  24.  
  25. public MyTextViewOpenSansLight(Context context, AttributeSet attrs, int defStyleAttr) {
  26. super(context, attrs, defStyleAttr);
  27. init();
  28. }
  29.  
  30. public MyTextViewOpenSansLight(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
  31. super(context, attrs, defStyleAttr, defStyleRes);
  32. init();
  33. }
  34.  
  35. private void init() {
  36. if (!isInEditMode()) {
  37. Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/OpenSans-Light.ttf");
  38. setTypeface(tf);
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement