我如何创建的EditText多行字符串? [英] how do i create a multiline string in EditText?

查看:119
本文介绍了我如何创建的EditText多行字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示的字符串多行的EditText。目前,该字符串显示为......

i want to display a string in a multiline EditText. Currently, the string displays as....

Receive: 0 coin(s) Total
             Cost: $100

我想希望它显示为...

I want want it to display as...

Receive: 0 coin(s) 
Total Cost: $10

这是我的code,我曾尝试使用\ n,但无济于事...

This is my code, I have tried to use "\n", but to no avail...

result.setText("Receive:"+ " "+ df.format(rawounces)+"coin(s)" + "\n" 
     + "Total Cost:$" + df.format(transactionandpremium*rawounces));

感谢你在前进。

推荐答案

您可以使用安卓的minlines =3显示中的EditText多行。 并在的EditText的顶部显示的光标,你可以像使用机器人:顶重力=

You can use the android:minLines="3" for display the multiline in edittext. and for display cursor on the top of the edittext you can use like android:gravity="top."

<EditText
            android:id="@+id/edittext"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:minLines="3"
            android:maxLines="5"
            android:gravity="top"
            android:inputType="textMultiLine" />

这篇关于我如何创建的EditText多行字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆