title: Edit Custom Views programmatically
body: <p>I created a layout like this:</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/rlMenu"
      android:layout_centerHorizontal="true"
      android:gravity="center"
      android:layout_centerVertical="true"&gt;
  
      &lt;RelativeLayout
          android:background="@drawable/dark_rectangle_bord"
          android:id="@+id/rl1dia"
          android:elevation="10dp"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_width="@dimen/sizeCard"
          android:layout_height="@dimen/sizeCard"
          android:layout_marginBottom="@dimen/padding_bottom_cards"
          android:layout_marginEnd="@dimen/padding_end_cards"
          android:layout_marginRight="@dimen/padding_end_cards"
          android:layout_marginLeft="@dimen/padding_start_cards"
          android:layout_marginStart="@dimen/padding_start_cards"
          android:layout_marginTop="@dimen/padding_top_cards"&gt;
  
          &lt;TextView
              android:text="1º Dia"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/tv1dia"
              android:textStyle="normal|bold"
              android:textColor="@color/Branco"
              android:layout_alignParentBottom="true"
              android:padding="10dp"
              android:textSize="@dimen/texto_pequeno"
              android:gravity="center"
              android:fontFamily="sans-serif"
              android:layout_centerHorizontal="true"/&gt;
  
          &lt;ImageView
              app:srcCompat="@drawable/ic_calendario_1"
              android:id="@+id/iv1dia"
              android:layout_width="@dimen/sizeImage"
              android:layout_height="@dimen/sizeImage"
              android:layout_centerHorizontal="true"
              android:layout_alignParentTop="true"
              /&gt;
  </code></pre>
  
  <p>After that, I had included it on my MainActivity.</p>
  
  <pre><code>    &lt;include
      android:id="@+id/my_custom_view"
      layout="@layout/custom_view&gt;&lt;/include&gt;
  </code></pre>
  
  <p>But in this Custom View there are a <code>RelativeLayout</code>, a <code>ImageView</code> and a <code>TextView</code>. I need to create some Custom Views dynamically, sample as below. </p>
  
  <p><strong>How can i create this Custom View Programatically?</strong>
  Ex.:</p>
  
  <pre><code>   Button bt = new Button(MainActivity.this);
  </code></pre>
  
  <p><strong>And how can I change the <code>TextView</code>, <code>RelativeLayout</code>, background and the <code>ImageView</code> programatically?</strong> Like:</p>
  
  <pre><code>  CustomView cv = new CustomView(MainActivity.this);
    cv.setImage(R.drawable.chips);
    cv.setRlBackground(Color.WHITE);
    cv.setText("Hello, World!");
  </code></pre>