:
ほとんどのソフトインプットメソッド現在のテキストフィールドに適したです下の隅にある、ユーザーのアクションボタンを提供しています。デフォルトでは、テキストフィールドに複数行のテキスト(android:inputType = "textMultiLine"など)が許可されていない限り、システムはこのボタンをNextまたはDoneアクションとして使用します。ただし、SendやGoなど、テキストフィールドに適したアクションを追加で指定することもできます。
複数行の場合。代わりに
android:inputType="text"
使用
android:inputType="textMultiLine"
のオーケー上記は、しかしライン(3)の制限なしのため、あなたのソリューションではありませんでした。あなたはコードを使用することができます
TextView tv = (TextView)findViewById(R.id.editText);
if (tv != null) {
tv.setHorizontallyScrolling(false);
tv.setLines(3);
}
今すぐマルチラインを得ることができます。
別の解決策は、あなたがのEditTextを拡張して、独自のEditTextを構築し、方法はACTION_SENDのためのあなたのscenarionを行うonCreateInputConnection上書きすることができ、次の
package com.gs;
import android.content.Context;
import android.util.AttributeSet;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.EditText;
public class ActionEditText extends EditText
{
public ActionEditText(Context context)
{
super(context);
}
public ActionEditText(Context context, AttributeSet attrs)
{
super(context, attrs);
}
public ActionEditText(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs)
{
InputConnection conn = super.onCreateInputConnection(outAttrs);
outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
return conn;
}
}
<com.gs.ActionEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="textAutoCorrect|textCapSentences|textMultiLine" />
を参照してください。XMLと、あなたの代わりに表示したいものを、その後 –
を示しているもののスクリーンショットを提供してください? – Amy
@Amy私が欲しいものを追加します –