           tab-width (get-resource :dimen :tab_width)]
       (set-state! this :tab-width (.getDimension res tab-width))
       (.updateLayout (get-state this :tabs))))
-;  (defn tab-bar-onMeasure
-;    [this hspec vspec]
-;    (.superOnMeasure this hspec vspec)
-;    (.superSetMeasuredDimension this
-;                           (- (.getMeasuredWidth this)
-;                              (get-state this :tab-add-overlap))
-;                           (.getMeasuredHeight this)))
-;  (defn tab-bar-onLayout
-;    [this changed left top right bottom]
-;    (let [new-tab (get-state this :new-tab)
-;          tabs (get-state this :tabs)
-;          pl (.getPaddingLeft this)
-;          pt (.getPaddingTop this)
-;          w (- right left pl)
-;          tab-add-overlap (get-state this :tab-add-overlap)
-;          button-width (- (.getMeasuredWidth new-tab) tab-add-overlap)
-;          sw (- w button-width)]
-;      (.layout tabs pl pt (+ pl sw) (- bottom top))
-;      (.layout new-tab (- (+ pl sw) tab-add-overlap) pt
-;               (- (+ pl sw button-width) tab-add-overlap) (- bottom top))))
+  (defn tab-bar-onMeasure
+    [this hspec vspec]
+    (.superOnMeasure this hspec vspec)
+    (.superSetMeasuredDimension this
+                           (- (.getMeasuredWidth this)
+                              (get-state this :tab-add-overlap))
+                           (.getMeasuredHeight this)))
+  (defn tab-bar-onLayout
+    [this changed left top right bottom]
+    (let [new-tab (get-state this :new-tab)
+          tabs (get-state this :tabs)
+          pl (.getPaddingLeft this)
+          pt (.getPaddingTop this)
+          w (- right left pl)
+          tab-add-overlap (get-state this :tab-add-overlap)
+          button-width (- (.getMeasuredWidth new-tab) tab-add-overlap)
+          sw (- w button-width)]
+      (.layout tabs pl pt (+ pl sw) (- bottom top))
+      (.layout new-tab (- (+ pl sw) tab-add-overlap) pt
+               (- (+ pl sw button-width) tab-add-overlap) (- bottom top))))
   )
 
 (defn show-tab-bar

                  w (- (.getRight tab) (.getLeft tab))]]
        (.layout tab total-left (.getTop tab) (+ total-left w) (.getBottom tab)))))
  (defn tab-layout-getChildDrawingOrder
    [this count i]
    ())
    )

(do

    (.superOnLayout this changed l t r b)
    (let []
      ))
  (defn tab-scroll-view-addTab
    [this]
    (let [content-view (get-state this :content-view)
          tab-view (net.nightweb.tabs.TabView. (get-state this :context))]
      (.setTitle tab-view "New Tab")
      (.setOnClickListener tab-view (on-click (.setSelectedTab this view)))
      (.setActivated tab-view true)
      (.addView content-view tab-view)))
  (defn tab-scroll-view-setSelectedTab
    [this view]
    (let [content-view (get-state this :content-view)
          num (.indexOfChild content-view view)
          old-view (.getChildAt content-view (get-state this :selected))]
      (if (> num -1)
        (set-state! this :selected num)
        (set-state! this :selected -1))
      (if old-view
        (.setActivated old-view false))
      (if view
        (.setActivated view true))
      (.requestLayout this)))
  (defn tab-scroll-view-getSelectedTab
    [this]
    (get-state this :selected))
  )

(do
  (gen-class
    :name "net.nightweb.tabs.TabView"
    :extends net.nightweb.LinearLayout
    :state "state"
    :init "init"
    :post-init "post-init"
