How to identify a row or a key in Android Keyboard -


i need identify each row or keys in row.

since row or key not have "id" attribute,we cannot find using findviewbyid.

iam wondering there way of identifying rows , keys in keyboard.you can find keyboard's xml file below.

<?xml version="1.0" encoding="utf-8"?> <keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keywidth="10%p" android:horizontalgap="0px" android:verticalgap="0px" android:keyheight="60dp" >  <row>     <key android:codes="49" android:keylabel="1" android:keyedgeflags="left"/>     <key android:codes="50" android:keylabel="2"/>     <key android:codes="51" android:keylabel="3"/>     <key android:codes="52" android:keylabel="4"/>     <key android:codes="53" android:keylabel="5"/>     <key android:codes="54" android:keylabel="6"/>     <key android:codes="55" android:keylabel="7"/>     <key android:codes="56" android:keylabel="8"/>     <key android:codes="57" android:keylabel="9"/>     <key android:codes="48" android:keylabel="0" android:keyedgeflags="right"/>  <row>     <key android:codes="113" android:keylabel="q" android:keyedgeflags="left"/>     <key android:codes="119" android:keylabel="w"/>     <key android:codes="101" android:keylabel="e"/>     <key android:codes="114" android:keylabel="r"/>     <key android:codes="116" android:keylabel="t"/>     <key android:codes="121" android:keylabel="y"/>     <key android:codes="117" android:keylabel="u"/>     <key android:codes="105" android:keylabel="i"/>     <key android:codes="111" android:keylabel="o"/>     <key android:codes="112" android:keylabel="p" android:keyedgeflags="right"/> </row> <row>     <key android:codes="97" android:keylabel="a" android:keyedgeflags="left"/>     <key android:codes="115" android:keylabel="s"/>     <key android:codes="100" android:keylabel="d"/>     <key android:codes="102" android:keylabel="f"/>     <key android:codes="103" android:keylabel="g"/>     <key android:codes="104" android:keylabel="h"/>     <key android:codes="106" android:keylabel="j"/>     <key android:codes="107" android:keylabel="k"/>     <key android:codes="108" android:keylabel="l"/>     <key android:codes="35,64" android:keylabel="\# \@" android:keyedgeflags="right"/> </row> <row>     <key android:codes="-1" android:keylabel="caps" android:keyedgeflags="left"/>     <key android:codes="122" android:keylabel="z"/>     <key android:codes="120" android:keylabel="x"/>     <key android:codes="99" android:keylabel="c"/>     <key android:codes="118" android:keylabel="v"/>     <key android:codes="98" android:keylabel="b"/>     <key android:codes="110" android:keylabel="n"/>     <key android:codes="109" android:keylabel="m"/>     <key android:codes="46" android:keylabel="."/>     <key android:codes="63,33,58" android:keylabel="\? ! :" android:keyedgeflags="right"/> </row> <row android:rowedgeflags="bottom">     <key android:codes="44" android:keylabel="," android:keywidth="10%p"  android:keyedgeflags="left"/>     <key android:codes="47" android:keylabel="/" android:keywidth="10%p" />     <key android:codes="32" android:keylabel="space" android:keywidth="40%p" android:isrepeatable="true"/>     <key android:codes="-5" android:keylabel="del" android:keywidth="20%p" android:isrepeatable="true"/>     <key android:codes="-4" android:keylabel="done" android:keywidth="20%p" android:keyedgeflags="right"/> </row> </row> 

thanks in advance

it depends on identifying keys of keyboard.

if want change appearance of keys, can list of keys in ondraw(canvas canvas) method of keyboardview class (public class yourskeyboardview extends keyboardview {...}):

@override public void ondraw(canvas canvas) {     super.ondraw(canvas);      list<key> keys = getkeyboard().getkeys();     (key key : keys) {         switch (key.codes[0]) {             //your key codes...         }     } } 

which identify keys android:codes="[your key code]" defined in xml.

or want override labels of keys on long press:

@override protected boolean onlongpress(key key) {     switch (key.codes[0]) {         //your key codes...     }      return super.onlongpress(key); } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -