The custom keyboard was contacted because of the work required. But found that the keyboard is too ugly to write some. No more nonsense, first.
The first one is modified. The second one is to change the money. This is basically
Ok. The next step is the point.
The Keyboardview properties of Android are Keybackground, but when used, they are found not to be effective. Carefully read the next source to find. The following sentence sets the property set to null. Therefore, the properties of the keyboard have not been effective.
New Keyboardview (thisnull);
The tragedy happened. It's going to be a solution. Since this is known, the attribute collection is empty. Then set the property collection to be. Review API Discovery. A lot of methods. One of the methods is chosen.
Xmlpullparser parser =activity.getresources (). GETXML (R.layout.keyboardview); AttributeSet attributes=Xml.asattributeset (parser); inttype; Try{ while(type = Parser.next ())! = Xmlpullparser.start_tag &&type!=xmlpullparser.end_document) { //Empty } if(Type! =Xmlpullparser.start_tag) {LOG.E ("", "the XML file is error!\n"); } } Catch(xmlpullparserexception e) {//TODO auto-generated Catch blockE.printstacktrace (); } Catch(IOException e) {//TODO auto-generated Catch blockE.printstacktrace (); } log.d ("",""+Parser.getattributecount ()); Keyboardview Mkeyboardview=NewKeyboardview ( This, attributes); Mkeyboardview.setfocusable (true); Mkeyboardview.setfocusableintouchmode (true); Mkeyboardview.setid (R.id.keyboard_view); Mkeyboardview.setvisibility (View.gone); Relativelayout.layoutparams LP=Newrelativelayout.layoutparams (RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATC H_parent); Lp.addrule (Relativelayout.align_parent_bottom, relativelayout.true); Relativelayout Rlyt=NewRelativelayout ( This); Rlyt.addview (Mkeyboardview, LP);
Keyboardview.xml is a collection of properties that are stored in the keyboard keyboardview. Setting a collection in this place is not a fear of not taking effect.
<?xml version= "1.0" encoding= "Utf-8"? ><android.inputmethodservice.keyboardview xmlns:android= "/http Schemas.android.com/apk/res/android " android:layout_width=" Fill_parent " android:layout_ Height= "wrap_content" android:layout_alignparentbottom= "true" Android:background = "@color/lightblack" android:focusable= "true" android:focusableintouchmode= " True " android:keybackground=" @drawable/btn_keyboard_key " android:keytextcolor= "@color/white" android:visibility= "Gone"/>
This is how the custom skin of the keyboard is implemented.
Android custom keyboard, code implementation custom properties (custom keyboard background, background of individual keys, etc.)