   (defn tab-scroll-view-onLayout
     [this changed l t r b]
     (.superOnLayout this changed l t r b)
-    (if-let [child (.getChildAt (get-state this :content-view)
-                                (get-state this :selected))]
-      (let [childl (.getLeft child)
-            childr (+ childl (.getWidth child))
-            viewl (.getScrollX this)
-            viewr (+ viewl (.getWidth this))]
-        (if (< childl viewl)
-          (.animateScroll this childl)
-          (if (> childr viewr)
-            (.animateScroll this (+ (- childr viewr) viewl)))))))
+    (.ensureChildVisible this))
   (defn tab-scroll-view-onScrollChanged
     [this l t oldl oldt]
     (.superOnScrollChanged this l t oldl oldt)

    :constructors {[android.content.Context] [android.content.Context]
                   [android.content.Context android.util.AttributeSet] [android.content.Context android.util.AttributeSet]
                   [android.content.Context android.util.AttributeSet int] [android.content.Context android.util.AttributeSet int]}
    :methods [["setTitle" [String] void]]
    :exposes-methods {onLayout superOnLayout
                      setActivated superSetActivated})
  (gen-class

                     this "scroll" (int-array [(.getScrollX this) new-scroll]))]
      (.setDuration animator ^int (get-state this :animation-duration))
      (.start animator)))
  (defn tab-scroll-view-setScroll
    [this new-scroll]
    (.scrollTo this new-scroll (.getScrollY this)))
  (defn tab-scroll-view-getScroll
    [this]
    (.getScrollX this))
  (defn tab-scroll-view-updateLayout
    [this]
    (for [i (range 0 (.getChildCount (get-state this :content-view)))
          :let [child (.getChildAt (get-state this :content-view) i)]]
      (.updateLayoutParams child))
    (.ensureChildVisible this))
  (defn tab-scroll-view-ensureChildVisible
    [this]
    (if-let [child (.getChildAt (get-state this :content-view)
                                (get-state this :selected))]
      (let [childl (.getLeft child)
            childr (+ childl (.getWidth child))
            viewl (.getScrollX this)
            viewr (+ viewl (.getWidth this))]
        (if (< childl viewl)
          (.animateScroll this childl)
          (if (> childr viewr)
            (.animateScroll this (+ (- childr viewr) viewl)))))))
  )

(do
