Last active
October 26, 2020 04:42
-
-
Save prographer/e32700cc4215cd0c37db to your computer and use it in GitHub Desktop.
Notofont TextVeiw Widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
tools:context="com.ucellslab.videoceans.activity.SearchResultsActivity"> | |
<com.prographer.widget.NotoTextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="@string/hello_world" /> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.prographer.widget; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Typeface; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.widget.TextView; | |
/** | |
* Created by PrographerJ on 2015-07-17. | |
* Notofont 설정 | |
*/ | |
public class NotoTextView extends TextView { | |
public NotoTextView(Context context) { | |
super(context); | |
setType(context); | |
} | |
public NotoTextView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
setType(context); | |
} | |
public NotoTextView(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
setType(context); | |
} | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public NotoTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | |
super(context, attrs, defStyleAttr, defStyleRes); | |
setType(context); | |
} | |
private void setType(Context context) { | |
//asset에 폰트 복사 | |
//NotoSnat 경령화된 폰트 위치: https://github.com/theeluwin/NotoSansKR-Hestia | |
this.setTypeface(Typeface.createFromAsset(context.getAssets(), "NotoSansKR-Regular.otf")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment