can Child View Scroll Down - Android User Interface

Android examples for User Interface:ScrollView

Description

can Child View Scroll Down

Demo Code


import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.widget.AbsListView;

public class Main {
  private static boolean canChildScrollDown(View mTarget) {
    if (Build.VERSION.SDK_INT < 14) {
      if (mTarget instanceof AbsListView) {
        final AbsListView absListView = (AbsListView) mTarget;
        return absListView.getChildCount() > 0
            && (absListView.getChildAt(absListView.getChildCount() - 1)
                .getBottom() < absListView.getPaddingBottom());
      } else {/*ww  w.j ava2 s .  com*/
        return mTarget.getScrollY() > 0;
      }
    } else {
      return ViewCompat.canScrollVertically(mTarget, 1);
    }
  }
}

Related Tutorials