设置多线的EditText的提示 [英] Set multi-line for EditText's HINT

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

问题描述

我知道我可以改变EditeText的文本行的号,但我可以改变的EditText的暗示呢?

I know that I could change the No. of lines for EditeText's Text, yet could I change that of EditText's hint as well?

我无法在网上找到一个解决方案。

I could not find a solution online.

感谢您的帮助。

我的code:

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.property_search, menu);
    super.onCreateOptionsMenu(menu, inflater);

    final MenuItem searchViewMenuItem = menu.findItem(R.id.action_search);
    mSearchView = (SearchView) searchViewMenuItem.getActionView();
    int searchSrcTextId = getResources().getIdentifier("android:id/search_src_text", null, null);
    EditText searchEditText = (EditText) mSearchView.findViewById(searchSrcTextId);
    searchEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
   searchEditText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    searchEditText.setHint(getString(R.string.search_hint));
}

的strings.xml

strings.xml

<string name="search_hint">keyword, location, \nmax price (e.g. 1K, 1M)</string>

我要的是:

关键词,位置,

最大价格(例如1K,1M)

max price (e.g. 1K, 1M)

推荐答案

在乌拉圭回合提示使用新的行分隔符\\ n

use new line separator \n in ur hint.

android:hint="first line of hint \n second line of hint so on.."

在字符串

<string name="urhint">first line of hint \n second line of hint so on..</string>

android:hint="@string/urhint"

希望工程..

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

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