android - switch keyboard from qwerty to number pad and vice versa -
android - switch keyboard from qwerty to number pad and vice versa -
i want adjust edittext input type such first want show number on keybord button switching keyborad numbers keypad qwerty .i have find many similar question related nil has worked out.
i have tried setting ime action button.don't know whether right or not not working me.is there other alternative this?
here code :
xml:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.helloword.mainactivity" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <edittext android:id="@+id/ed" android:layout_height="wrap_content" android:layout_width="fill_parent" android:imeoptions="actiongo|actionnext|actionsend|actiondone" android:imeactionlabel="abc" android:inputtype="number" android:imeactionid="@+id/my_ime"/> </relativelayout> activity:
public class mainactivity extends actionbaractivity { edittext ed; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ed = (edittext)findviewbyid(r.id.ed); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. ed.setoneditoractionlistener(new oneditoractionlistener() { @override public boolean oneditoraction(textview arg0, int arg1, keyevent arg2) { // todo auto-generated method stub if(arg1==r.id.my_ime) { log.e("inside", "inside"); ed.setinputtype(inputtype.type_class_text); } homecoming false; } }); getmenuinflater().inflate(r.menu.main, menu); homecoming true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); if (id == r.id.action_settings) { homecoming true; } homecoming super.onoptionsitemselected(item); } } android android-edittext android-keypad
Comments
Post a Comment