我有编辑文本填充问题

时间:2022-06-11 10:41:43

I'm having issues with the padding of TextView. I want to start writing something from the top not from center of TextView Box. Please see the code and Screenshot.

我遇到了TextView填充的问题。我想从顶部而不是从TextView Box的中心开始写一些东西。请参阅代码和截图。

TextView Code:

<EditText
    android:layout_width="match_parent"
    android:layout_height="150dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="4dp"
    android:background="@drawable/edittextstyle"
    android:padding="10dp"
    android:textSize="17sp"
    android:id="@+id/review_comments"/>

edittextstyle.xml

   <shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:thickness="0dp"
   android:shape="rectangle">
   <stroke android:width="1dp"
   android:color="#000000"/>

   <corners android:radius="2dp" />


   <gradient
   android:startColor="#C8C8C8"
   android:endColor="#FFFFFF"
   android:type="linear"
   android:angle="270"/>
   </shape>

http://i.imgur.com/p9rZDjW.png

1 个解决方案

#1


0  

Try adding this to your EditText:

尝试将此添加到EditText:

android:gravity="top|left"

#1


0  

Try adding this to your EditText:

尝试将此添加到EditText:

android:gravity="top|left"