title: How to set android:layout_width="match_parent" from code?
body: <p>I've different layout. Some created by xml. Some others dynamically via code. When I am on xml I can set width or height with &quot;wrap_content&quot; value. How to get the same result dynamically? This is the snippet of my dynamic TextView. I need to remove &quot;final int width = 440;&quot; and get same value of &quot;wrap_content&quot;. How?</p>
  <pre><code>final int width = 440;
  final int height = textViewHeight;
  final int top = getNewTop(height);
  
  FrameLayout.LayoutParams layoutParams;
  layoutParams = getLayoutParams(width, height, top);
  
  TextView textView;
  textView = new TextView(_registerNewMealActivity);
  textView.setText(text);
  textView.setLayoutParams(layoutParams);
  
  _frameLayout.addView(textView);
  </code></pre>