title: Why does LinearLayout instance.getLayoutParams look to have a wrong class?
body: <p>If I declare <code>LinearLayout linearLayout</code> and look at <code>linearLayout.getLayoutParams()</code>, it gives me <code>ViewGroup.LayoutParams</code>, not <code>LinearLayout.LayoutParams</code>.</p>
  
  <p>So I have to use the repeating (and thus bad) style construction of:</p>
  
  <pre><code>int lm = ((LinearLayout.LayoutParams) linearLayout.getLayoutParams()).leftMargin?
  </code></pre>
  
  <p>Do I really have to use it, if I want to reach margins, for example?</p>
  
  <p>Is it my misunderstanding of Android or Java, or both or something else?</p>