I am making an app in which i have to use edit text and when i use this text on samsung galaxy s and emulator , the text starts from center of edittext rather than starting from top.The screen shot and code is as follows`
<EditText android:id="@+id/tester"
android:layout_height="113dip"
android:layout_width="420dip"
android:background="@drawable/textarea_reason"
android:paddingTop="-90dip"/>
`
You need to change gravity parameter.
Java Code
editText.setGravity(Gravity.TOP| Gravity.LEFT);
XML
<EditText
android:id="@+id/tester"
android:layout_height="113dip"
android:layout_width="420dip"
android:background="@drawable/textarea_reason"
android:gravity="top|left"/>
Update yor Edit Text tag like as...
<EditText
android:id="@+id/tester"
android:layout_height="113dip"
android:layout_width="420dip"
android:background="@drawable/textarea_reason"
android:gravity="top|left"/>
你已经设置了背景图像,这就是为什么会出现这个问题,把android:paddingLeft =“20dp”和测试
尝试将xml或minLines
中的编辑文本属性singleLine="false"
minLines
为> 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.