Android ViewGroup Set setReadingFontOnChildren(ViewGroup container)

Here you can find the source of setReadingFontOnChildren(ViewGroup container)

Description

set Reading Font On Children

License

Open Source License

Declaration

public static void setReadingFontOnChildren(ViewGroup container) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Typeface;

import android.view.View;
import android.view.ViewGroup;

import android.widget.TextView;

public class Main {
    public static void setReadingFontOnChildren(ViewGroup container) {
        Typeface font = Typeface.createFromAsset(container.getContext()
                .getAssets(), "Palatino.ttc");
        View this_view;
        for (int x = 0; x < container.getChildCount(); x++) {
            this_view = container.getChildAt(x);
            if (this_view.getTag() != null) {
                if (this_view.getTag().toString().compareTo("custom_font") == 0) {
                    ((TextView) this_view).setTypeface(font,
                            Typeface.NORMAL);
                } else if (this_view.getTag().toString()
                        .compareTo("custom_font_bold") == 0) {
                    ((TextView) this_view).setTypeface(font, Typeface.BOLD);
                } else if (this_view.getTag().toString()
                        .compareTo("custom_font_italic") == 0) {
                    ((TextView) this_view).setTypeface(font,
                            Typeface.ITALIC);
                }/*from   w  ww  .ja  v a  2  s .  c  o  m*/
            }
        }
    }
}

Related

  1. layoutChildAbsoluteCenter(ViewGroup parent, View child, int tWidth, int tHeight)
  2. setSelected(ViewGroup viewGroup, boolean selected)
  3. disableView(ViewGroup rootView, float alpha)