开发者

Is there any way to fix the amount of characters per line in an EditText without doing it programatically?

开发者 https://www.devze.com 2023-02-11 11:00 出处:网络
I just want to set the maximum amount of characters per line, so that the words will wrap onto the next line. Is there any way to do this? I looked over the EditText documentation and I don\'t see a c

I just want to set the maximum amount of characters per line, so that the words will wrap onto the next line. Is there any way to do this? I looked over the EditText documentation and I don't see a clear way of doing this.

开发者_JS百科

Any help is appreciated


You can set

android:maxWidth="200dip"

Inside your xml file for the EditText. This will make it wrap the text on to the next line once the width is reached. You'll have to play with the dip value to see how big you want it. As far as I know there is no way to measure this in characters though. You'll need to have the layout_height set to "wrap_content" also if you want the view to grow to show the text as it gets typed, if its longer than your view.


you can set maxlength property of edittext in our xml.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号