Forum Xamarin Xamarin.Android

GlobalLayout - current count of lines in the textview

I need an advice. I do a project in Mono Droid. I used GlobalLayout because I need to find out an actual count of rows. Into the event I have boolean variable, but this variable is always rewrited for false. I dont know why.

bool isLonger; //after declaration the class
public bool IsLonger(TextView tv)
var vto = tv.ViewTreeObserver;
vto.GlobalLayout += delegate {
if (tv.LineCount > MAX_LINE) {
isLonger = true;

            } else {
                isLonger = false;


        System.Diagnostics.Debug.WriteLine (isLonger.ToString ());

        if (isLonger) {
            System.Diagnostics.Debug.Write ("jsem true");
            return true;
        else {
            return false;


Thank you

Sign In or Register to comment.