title: How to use addView to add view to layout?
body: <p>I have read probably all posts and documentation but I still can't solve this issue.</p>
  
  <p>I want to use <code>addView()</code> method to add view to the existing (running) layout but for some reason I cant. I know that this should be easy and basic but still I cant do it. So, please help me.</p>
  
  <p>Here is a code:</p>
  
  <pre><code>LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);
  TextView text       = new TextView(this);
  text.setText("test");
  layout.addView(text);
  </code></pre>
  
  <p>That's a code, and the result is that I have displayed only views which are defined in XML file. There is no this new view I have added.
  When I debug I see this added view as a child of the parent to which I have added it but it isn't displayed.</p>
  
  <p>here is main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
                  android:id="@+id/mainLayout"
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:background="@drawable/main1" &gt;
      &lt;TextView android:id="@+id/app_title"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#FFF"
                android:text="@string/app_title"
                android:textSize="25dp" 
                android:gravity="center_horizontal"/&gt;
      &lt;TextView android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:text="@string/main_screen_counter_title"
                android:textSize="15dp" 
                android:textColor="#FFF"
                android:gravity="center_horizontal"/&gt;
     &lt;TextView android:id="@+id/frontScreenCounter"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:textColor="#FFF"
                android:text="@string/reading"
                android:textSize="33dp"
                android:gravity="center_horizontal" /&gt;   
      &lt;GridView android:id="@+id/gridview"
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"
      android:columnWidth="90dp"
      android:numColumns="3"
      android:verticalSpacing="10dp"
      android:horizontalSpacing="10dp"
      android:stretchMode="columnWidth"
      android:gravity="center"
      android:textColor="#888"
  /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Please help. This will driving me nuts!</p>