get View Vertical Scroll Factor - Android User Interface

Android examples for User Interface:ScrollView

Description

get View Vertical Scroll Factor

Demo Code


//package com.java2s;
import android.util.TypedValue;
import android.view.View;

public class Main {
    public static float getVerticalScrollFactor(View view) {
        TypedValue outValue = new TypedValue();
        if (!view
                .getContext()//from w  ww .j ava2s  . co m
                .getTheme()
                .resolveAttribute(android.R.attr.listPreferredItemHeight,
                        outValue, true)) {
            throw new IllegalStateException(
                    "Expected theme to define listPreferredItemHeight.");
        }
        return outValue.getDimension(view.getResources()
                .getDisplayMetrics());
    }
}

Related Tutorials