Android的多行数的EditText [英] Android multiline number edittext

查看:636
本文介绍了Android的多行数的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建Android的一个EditText其中有几个线条和数字输入。它为矩阵的输入端。我已经有一个解决方案来的android:inputType下=textMultiLine然后 setRawInputType(Configuration.KEYBOARD_12KEY)。然而,编辑水平方向的EditText上时,这并不工作,它也没有显示斜杠( / ),我需要输入分数。如果我设置输入类型 setRawInputType(InputType.TYPE_CLASS_NUMBER),它也不会在水平方向上工作,我总是输入一个空格之后,它切换到正常输入键盘。你知道的任何解决方案,它可以帮助我吗?

I want to create an EditText in Android which has several lines and number input. It is for the input of a matrix. I already have a solution to set android:inputType="textMultiLine" and then setRawInputType(Configuration.KEYBOARD_12KEY). However, this does not work when editing the edittext in horizontal orientation and it also does not show the slash (/) which I need to input fractions. If I set the input type tosetRawInputType(InputType.TYPE_CLASS_NUMBER), it also does not work in horizontal orientation and always after I enter a space, it switches to the normal input keyboard. Do you know any solution which would help me?

推荐答案

在这种方式可以创建多行的EditText允许数字和数字具有键盘

In this way could be created multiline EditText which allow only numbers and has digit keyboard

   <EditText

                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:digits="0,1,2,3,4,5,6,7,8,9,/"
                android:inputType="textMultiLine|phone" />

这篇关于Android的多行数的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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