Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Any attribute prefixed with <code>layout_</code> is part of a <a href="http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html" rel="nofollow"><code>LayoutParams</code></a> object. LayoutParams are special arguments to the parent view about how it should lay out the child view. The type of LayoutParams you set on a view is dependent on what type of ViewGroup you are adding it to. Each container view type can be different and so can the LayoutParams. <code>layout_weight</code> is specific to LinearLayout, <code>layout_below</code> is for RelativeLayout, etc. <code>layout_width</code> and <code>layout_height</code> are part of the base ViewGroup LayoutParams.</p> <p>The takeaway from this is that LayoutParams are not parsed by the view's constructor, they're parsed by another step that your code above isn't doing. (The LayoutInflater involves the parent ViewGroup's <a href="http://developer.android.com/reference/android/view/ViewGroup.html#generateLayoutParams%28android.util.AttributeSet%29" rel="nofollow"><code>generateLayoutParams</code></a> method.)</p> <p>Since LayoutParams are dependent on the intended parent of the View it's not recommended to put LayoutParams in styles. It <em>mostly</em> works when you are inflating views from layout XML but it has other implications similar to the edge case you've found here and requires you to be aware of them. For example, a style may specify <code>layout_weight</code> for a LinearLayout but if a view with that style is added to a RelativeLayout instead it will not behave as expected since RelativeLayout does not support <code>layout_weight</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload