 could be either actual values or keywords `:fill` and `:wrap`.
 
 Taken from clj-android by remvee."
-  ([both]
-    `(let [both# ~(or (attribute-values both)
-                                ViewGroup$LayoutParams/WRAP_CONTENT)]
-       (new ViewGroup$LayoutParams both# both#)))
-  ([width height]
-    `(let [width# ~(or (attribute-values width)
-                                 ViewGroup$LayoutParams/WRAP_CONTENT)
-           height# ~(or (attribute-values height)
-                                  ViewGroup$LayoutParams/WRAP_CONTENT)]
-       (new ViewGroup$LayoutParams width# height#))))
+  ([width height weight]
+    (let [real-width (attribute-value :layout-params (or width :wrap))
+          real-height (attribute-value :layout-params (or height :wrap))
+          real-weight (or weight 0)]
+      `(new LinearLayout$LayoutParams ~real-width ~real-height ~real-weight))))
 
 (defmethod transform-attributes :layout-params [el-type obj attributes
                                                 generated-code]
-  [(dissoc attributes :layout-width :layout-height)
+  [(dissoc attributes :layout-width :layout-height :layout-weight)
    (conj generated-code
          `(.setLayoutParams ~obj
                             ~(layout-params (:layout-width attributes)
-                                            (:layout-height attributes))))])
+                                            (:layout-height attributes)
+                                            (:layout-weight attributes))))])
 
 ;; ### Default attributes
 

  (str (.toUpperCase (.substring s 0 1)) (.substring s 1)))

(defn default-setters-from-attributes
  "Takes an object symbol and the attributes map after all
  `transform-attributes` methods have been called on it. Transforms
  each attribute into a call to (.set_CapitalizedKey_ obj value). If
  value is a keyword then it is looked up in the attribute-values map.
  Returns a list of setter calls. "
  [obj attributes]
  (map (fn [[attr value]]
         (let [real-value (if (and (keyword? value)
                                   (contains? attribute-values value))
                            (attribute-values value)
                            value)]
           `(~(symbol (str ".set" (capitalize (name attr)))) ~obj ~real-value)))
         attributes))

                [attributes ()]
                (conj (all-parents el-type) el-type))]
    (concat generated-code
            (default-setters-from-attributes el-type obj rest-attributes))))

;; ## Top-level code-generation facilities

(defn make-ui-element
  "Takes a tree of elements and generates the code to create a new
