0

How can I customize the text displayed in the IME action buttton for an EditTextView. I tried to use setImeActionLabel but it doesn't work.

public class TestIMEActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
        final EditText ed1 = new EditText(this);
        ed1.setSingleLine(true);
        ed1.setImeActionLabel("test", 0);
        layout.addView(ed1, params);
        setContentView(layout);
    }
}
user1753118
  • 89
  • 2
  • 7
  • Which label are you trying to change? [This answer](http://stackoverflow.com/a/1541161/752320) might be of use. – Geobits Nov 20 '12 at 19:33

1 Answers1

0

I've tried to set it dynamically. Try to set it on your xml:

android:imeActionLabel="@string/myCustomActionLabel"

It works with me.

Note that your text will be visible only in landscape mode.

JPMagalhaes
  • 3,611
  • 1
  • 25
  • 26