import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class MarkerTextView extends TextView {
private Context c;
public MarkerTextView(Context c) {
super(c);
this.c = c;
Typeface tfs = Typeface.createFromAsset(c.getAssets(),
"fonts/marker.ttf");
setTypeface(tfs);
}
public MarkerTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.c = context;
Typeface tfs = Typeface.createFromAsset(c.getAssets(),
"fonts/marker.ttf");
setTypeface(tfs);
}
public MarkerTextView(Context context, AttributeSet attrs) {
super(context, attrs);
this.c = context;
Typeface tfs = Typeface.createFromAsset(c.getAssets(),
"fonts/marker.ttf");
setTypeface(tfs);
}
}
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class MarkerTextView extends TextView {
private Context c;
public MarkerTextView(Context c) {
super(c);
this.c = c;
Typeface tfs = Typeface.createFromAsset(c.getAssets(),
"fonts/marker.ttf");
setTypeface(tfs);
}
public MarkerTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.c = context;
Typeface tfs = Typeface.createFromAsset(c.getAssets(),
"fonts/marker.ttf");
setTypeface(tfs);
}
public MarkerTextView(Context context, AttributeSet attrs) {
super(context, attrs);
this.c = context;
Typeface tfs = Typeface.createFromAsset(c.getAssets(),
"fonts/marker.ttf");
setTypeface(tfs);
}
}
and in xml:
<com.examples.MarkerTextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff" />
Use can add nice shadow effects using:
android:shadowColor="#80ffffff"
android:shadowDx="1"
android:shadowDy="2"
android:shadowRadius="2"
No comments:
Post a Comment