你加上这个看看能否看到预览数字
keyboardView.setBackgroundColor(Color.RED);

解决方案 »

  1.   

    @AMinfo设置背景不是上面预览的…   而是键盘本身后面的
      

  2.   

    那个小窗口API解释是 key feedback popup
    但是怎么设置其属性却没有说
      

  3.   

    是的。 因为第一次接触键盘,所以看了一个keyboardDemo之后按照Demo上面的方法写的一个布局
    不知道为什么,方法基本都一样,函数也就改了下响应内容。但是就是变成白板,感觉也没什么地方变动会引起这个问题
      

  4.   


    <?xml version="1.0" encoding="utf-8"?>
    <Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
        android:keyWidth="35dip"
        android:horizontalGap="0px"
        android:verticalGap="0px"
        android:keyHeight="32dip">
        <Row>
            <Key android:codes="49" android:keyLabel="1" />
            <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:keyIcon="@drawable/ic_dialog_keyboard"/>
            <Key android:codes="46" android:keyLabel="." />
            <Key android:codes="57419" android:keyLabel="+/-"/>
            <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete" />
            <Key android:codes="57421" 
                 android:keyEdgeFlags="right"
                 android:isRepeatable="true"
                 android:keyLabel="取消"/>
            <Key android:codes="-3"
                 android:keyEdgeFlags="right"
                 android:isRepeatable="true"
                 android:keyLabel="完成" />    </Row>
    </Keyboard>键盘布局
      

  5.   


         <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="5dp"
            android:paddingTop="5dp"
            android:layout_below="@+id/R_speed" >        <android.inputmethodservice.KeyboardView
                android:id="@+id/keyboard_view"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:visibility="gone" />
        </RelativeLayout>键盘在页面内的布局
      

  6.   


     View view = inflater.inflate(R.layout.item_system, null);
    llc.addView(view);
    X_speed = (EditText)view.findViewById(R.id.X_speed);
    X_speed.setInputType(InputType.TYPE_NULL);
    X_speed.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View arg0, MotionEvent arg1) {
    // TODO Auto-generated method stub
    ed = X_speed;
        showKeyboard();
    return false;
    }
    });
    keyboardView = (KeyboardView)view.findViewById(R.id.keyboard_view);
            keyboardView.setKeyboard(new Keyboard(activity.getApplicationContext(), R.xml.keyboard));
            keyboardView.setEnabled(true);
            keyboardView.setPreviewEnabled(false);
            keyboardView.setOnKeyboardActionListener(new OnKeyboardActionListener() {
                @Override
                public void onKey(int primaryCode, int[] keyCodes) {
                    Editable editable = ed.getText();
                    int start = ed.getSelectionStart();
                    if (primaryCode == Keyboard.KEYCODE_CANCEL) {
                        hideKeyboard();
                    } else if (primaryCode == Keyboard.KEYCODE_DELETE) {
                        if (editable != null && editable.length() > 0) {
                            editable.delete(start - 1, start);
                        }
                    } else if (primaryCode == 57419) { // go left
                       ed.setText(String.valueOf(0-(Integer.valueOf(ed.getText().toString()))));
                     ed.setSelection(ed.getText().toString().length());//
                    } else if (primaryCode == 57421) { // go right
                     if(proEdTxt!= null){
                     ed.setText(proEdTxt);
                     hideKeyboard();
                     }
                                     
                    } else {
                     proEdTxt=ed.getText().toString();
                        editable.insert(start, Character.toString((char)primaryCode));
                        
                    }
                }键盘java代码
      

  7.   

    代码不完整啊showKeyboard();和hideKeyboard();proEdTxt这个组件定义也没有。
      

  8.   

    这个只是设置键盘显示和隐藏的函数, 没什么特别的地方,
    和按下数字显示白板没关系。
    keyboardView.setPreviewEnabled(false);
    这个是不显示白板,直接点击按键之后就在EditText上面输入数字, 设置为true后就是白板
      

  9.   

    似乎回得太晚 不過給個解答
    在AndroidManifest.xml中加入theme
    <application
          
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Dialog" >
      

  10.   

    请问@AMinfo,你是用鼠标点击的还是使用实体键盘,我们需要使用实体键盘(外置的Hard keyboard)来实现点击键盘,出现key feedback popup
      

  11.   

    此贴对我帮助很大,让我明白原来这玩意不叫气泡不叫气球也不叫提示不叫hint不叫popup更不叫坑爹的balloon原来是叫preview!!!