Posts

Showing posts from July, 2014

Using Custom fonts through XML.

1st Create the custom TextView through java, package com.example.customfont; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Typeface; import android.util.AttributeSet; import android.util.Log; import android.widget.TextView; public class CustomTextView extends TextView {     private static final String TAG = "TextView";     public CustomTextView(Context context) {         super(context);     }     public CustomTextView(Context context, AttributeSet attrs) {         super(context, attrs);         setCustomFont(context, attrs);     }     public CustomTextView(Context context, AttributeSet attrs, int defStyle) {         super(context, attrs, defStyle);         setCustomFont(context, attrs);     }     private void setCustomFont(Context ctx, AttributeSet attrs) {         TypedArray a = ctx.obtainStyledAttributes(attrs, R.styleable.TextViewPlus);         String customFont = a.getString(R.styleable.CustomTextVi

Highlight text on EditText

If somebodies want to click to highlight the text in edittext, Just add one line in XML, android:selectAllOnFocus="true" to highlight the text. Uses: Clear Highlight text. Change the new text.