Utkarsh Srivastav
Utkarsh Srivastav

Reputation: 3227

How to set the text alignment of edit text to bottom programatically?

I have checked following properties(http://developer.android.com/reference/android/widget/EditText.html) but none is working. How to set the text alignment of edit text to bottom programatically?

Upvotes: 0

Views: 1758

Answers (2)

Sarthak Mittal
Sarthak Mittal

Reputation: 6104

Maybe the problem is because you have set the EditText height as wrap_content, try giving it a hardcoded value:

Example : android:layout_height="50dp"

Upvotes: 1

Jeffy Lazar
Jeffy Lazar

Reputation: 1923

yes that can be done with the help of android:gravity="bottom"

eg below

  <EditText
            android:id="@+id/name"
            android:layout_width="1dp"
            android:layout_height="45dp"
            android:text="abc india"
            android:gravity="bottom" />

programatically

editText.setGravity(Gravity.BOTTOM);

Upvotes: 1

Related Questions