       (.lineTo focus-path local-l local-t)
       (.lineTo focus-path (- local-r (get-state this :tab-slice-width)) local-t)
       (.lineTo focus-path local-r local-b)))
+  (defn tab-view-setActivated
+    [this selected]
+    (set-state! this :selected selected)
+    (let [context (get-state this :context)
+          title (get-state this :title)
+          icon-view (get-state this :icon-view)
+          close (get-state this :close)]
+      (.setTextAppearance title context (if selected (get-resource :style :TabTitleSelected) (get-resource :style :TabTitleUnselected)))
+      (.setVisibility icon-view (if selected android.view.View/GONE android.view.View/VISIBLE))
+      (.setVisibility close (if selected android.view.View/VISIBLE android.view.View/GONE))
+      (.setHorizontalFadingEdgeEnabled this (not selected))
+      (.superSetActivated this selected)
+;      (.setLayoutParams this (android.view.ViewGroup$LayoutParams.
+;                               (get-state this :tab-width)
+;                               android.view.ViewGroup$LayoutParams/MATCH_PARENT))
+      (.setFocusable this (not selected))
+      (.postInvalidate this)))
   (defn tab-view-setTitle
     [this text]
     (let [title (get-state this :title)]

            tabs (find-view this (get-resource :id :tabs))
            new-tab (find-view this (get-resource :id :newtab))]
        (.setPadding this 0 tab-padding-top 0 0)
        (.setOnClickListener new-tab
                             (on-click (println "on-click")))
        (set-state! this :tabs tabs)
        (set-state! this :new-tab new-tab)
        ))
    ([this context attrs] (tab-bar-post-init this context))
    ([this context attrs def-style] (tab-bar-post-init this context)))
  (defn tab-bar-onConfigurationChanged

                   [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})
  (defn tab-view-create-state
    [context]
    (atom {:context context
           :selected false
           :path (android.graphics.Path.)
           :focus-path (android.graphics.Path.)
           :tab-slice-width (get-resource :dimen :tab_slice)
           :tab-overlap (get-resource :dimen :tab_overlap)}))
  (defn tab-view-init
    ([context] [[context] (tab-view-create-state context)])
    ([context attrs] [[context attrs] (tab-view-create-state context)])
