Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.Layout;

import android.widget.TextView;

public class Main {
    public static int getLastLine(TextView tv) {
        int height = tv.getHeight();
        int scrollY = tv.getScrollY();
        Layout layout = tv.getLayout();

        if (layout == null) {
            return 0;
        }
        // int firstVisibleLineNumber = layout.getLineForVertical(scrollY);
        int lastVisibleLineNumber = layout.getLineForVertical(scrollY + height);
        return lastVisibleLineNumber;
    }
}