Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change the text size? #4

Open
iloster opened this issue Jan 3, 2017 · 1 comment
Open

how to change the text size? #4

iloster opened this issue Jan 3, 2017 · 1 comment

Comments

@iloster
Copy link

iloster commented Jan 3, 2017

No description provided.

@gorrotowi
Copy link

import android.view.ViewGroup
import android.widget.TextView
import io.github.angebagui.mediumtextview.ParagraphView
import mx.jetty.jetty.jettyelements.FontManager

/**
 * @author Gorro
 * @since 06/09/17.
 */

fun ViewGroup.setFont() {
    (0..this.childCount).map {
        val view = this.getChildAt(it)
        if (view is ParagraphView) {
            (0..view.childCount).map { index ->
                val txtV = view.getChildAt(index)
                if (txtV is TextView) {
                    if (it == 0) {
                        FontManager(txtV.context).initStyle(txtV, 1)
                        txtV.textSize = 24f
                    } else {
                        FontManager(txtV.context).setTypeFace(txtV)
                    }
                }
            }
        }
    }
}

I wrote this Kotlin function to change the font
Of course

FontManager(txtV.context).initStyle(txtV, 1)

it's a function to set te TypeFont :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants