title: change text gravity to top in Android
body: <p>I need to dynamically change Android text <code>Gravity</code> to the <code>TOP</code> in My ListItems.
  Code used for ListItem:</p>
  
  <p><strong>XML layout file:</strong></p>
  
  
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="@dimen/ma_list_item_height"&gt;
                     ..............
  &lt;TextView
          android:id="@+id/driver_passage_text_view"
          android:layout_width="0dp"
          android:layout_height="@dimen/ma_list_item_height"
          android:layout_weight="1"
          android:gravity="center_horizontal|center_vertical"
          android:text="Ivanov Ivan Ivanich"
          android:padding="0"
          /&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have read about <code>Gravity</code> and property <code>setIncludeFontPadding</code>, I have tried to use it but it is not working in my case, Code used :</p>
  
  <pre><code> private void setGravityAndText(TextView textView,String text){
     if(text.length()&gt;24){
          textView.setIncludeFontPadding(true);
          textView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
     }
      else {
         textView.setIncludeFontPadding(false);
         textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
     }
      textView.setText(text);
  
  }
  </code></pre>
  
  <p>Horizontal alignment is working  successfully, but on the top anyway doesn't work? What did I do wrong?</p>
  
  <p>Please Help.</p>
  
  <p>Thanks in Advance.</p>