为了方便动态使用自定义KeyboardView, 对其进行了封装
public class KeyboardView extends FrameLayout {
private Context mcontext;
public KeyboardView(Context context) {
super(context);
mcontext = context;
initComponents();
}
}
但是每次在MainActivity中执行到加载的时候:
keyboardView = (KeyboardView)stub.inflate();
就会报错: view.inflate.exception, 首先发现在xml中自己直接使用了:
<KeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_gravity="bottom" >
<KeyboardView /> 标签, 而androd有个自带的控件:
android.inputmethodservice.KeyboardView, 所以将xml中标签改成了:
<com.yzh.lockpri2.widget.KeyboardView xmlns:android="http://sch