Android custom keyboard popup keyboard on long press -
i have custom android keyboard:
    public class customkeyboard extends keyboard{...}        public class customkeyboardview extends keyboardview{...}      public class customkeyboardime extends inputmethodservice implements keyboardview.onkeyboardactionlistener{...}     on keys, have popupkeyboard , popupcharacters:
<key android:codes="144" android:keylabel="0" android:popupkeyboard="@xml/key_popup" android:popupcharacters=")" android:keyedgeflags="right"/>   xml/key_popup.xml:
<keyboard xmlns:android="http://schemas.android.com/apk/res/android"       android:keywidth="10%p"       android:horizontalgap="0px"       android:verticalgap="0px"       android:keyheight="@dimen/key_height" > </keyboard>   but when longpress on "0" key popup ")" shows, stays there until press "x" button or ")" character. looks this:
 
and want opened while holding finger on. on samsung or htc keyboard:
 
  
can me please?
edit @ least possible change appearance of popup? want have same background , keys whole keyboard have made/
you can use popupwindow class , populate custom layout.
view custom = layoutinflater.from(context)     .inflate(r.layout.your_layout, new framelayout(context)); popupwindow popup = new popupwindow(context); popup.setcontentview(custom);   and on long press
//get x,y based on touch position //get width, height based on layout if(popup.isshowing()){     popup.update(x, y, width, height); } else {     popup.setwidth(width);     popup.setheight(height);     popup.showatlocation(yourkeyboardview, gravity.no_gravity, x, y); }   on click in popup can dismiss it
popup.dismiss();      
Comments
Post a Comment