Code example for CheckedTextView

Methods: setTextsetTypeface

0
                // Find the text view from our interface 
                CheckedTextView tv = (CheckedTextView) view.findViewById( android.R.id.text1 );
  
                // Replace the string with the current font name using our typeface 
                Typeface tface = Typeface.createFromFile( m_fontPaths.get( position ) );
                tv.setTypeface( tface );
  
                // If you want to make the selected item having different foreground or background color, 
                // be aware of themes. In some of them your foreground color may be the background color. 
                // So we don't mess with anything here and just add the extra stars to have the selected 
                // font to stand out. 
                tv.setText( m_fontNames.get( position ) );
            } 
  
            return view;
        } 
    } 
  
    public FontPreference( Context context, AttributeSet attrs )
    { 
        super(context, attrs);