Android的 - 关于web视图编辑文字问题视图、编辑、文字、问题

2023-09-03 21:44:06 作者:问世间谁能敌我

我使用的是编辑文本放在一个网址,在网上进行搜索。但要使用URL,我需要把HTTP:// URL中的前面。有没有一种方法,来掩饰这一点,并使用它的默认?

和另一件事是在编辑文本只有一个单行?

感谢

解决方案   

有没有一种方法,来掩饰这一点,并使用它的默认?

在检索来自的EditText ,看到的价值,如果它有一个公认的计划开始(例如,的https:// )。如果没有,你自己添加它,通过字符串连接或的StringBuilder 什么的。

  Android手机端有哪些是目录树视图的文件管理器 就是图上那样,图上的是X plore,目前我唯

和另一件事是在编辑文本只有一个单行?

使用安卓MAXLINES =1<的EditText> 在布局元素

I'm using a Edit Text to put in a URL to search in the Internet. But to use a URL, I need to put http:// in front of the Url. Is there a way, to hide this and use it for default?

And the other thing is to have only one single line in the Edit Text?

Thanks

解决方案

Is there a way, to hide this and use it for default?

When you retrieve the value from the EditText, see if it begins with a recognized scheme (e.g., https://). If not, add it yourself, through string concatenation or StringBuilder or something.

And the other thing is to have only one single line in the Edit Text?

Use android:maxLines="1" in the <EditText> element in your layout.