title: How to change TextView gravity programmatically using constraint layout
body: <p>In xml layout, gravity of the TextView is setted. In some condition, I want to change the gravity of the TextView in my coding.I have tried to set like this:</p>
  
  <pre><code>title.setGravity(Gravity.START);
  </code></pre>
  
  <p>but no change.</p>
  
  <p>In xml I have aligned text view gravity to center.
  I have to change this gravity to START in some condition programmatically:</p>
  
  <pre><code>&lt;TextView
          android:id="@+id/text"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginBottom="8dp"
          android:layout_marginEnd="8dp"
          android:layout_marginLeft="8dp"
          android:layout_marginRight="8dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="8dp"
          android:gravity="center"
          android:text=" "
          android:drawablePadding="5dp"
          android:textColor="@color/colorPrimary"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  </code></pre>
  
  <p>So how to do that?</p>