當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyboardView類代碼示例

本文整理匯總了Java中android.inputmethodservice.KeyboardView的典型用法代碼示例。如果您正苦於以下問題:Java KeyboardView類的具體用法?Java KeyboardView怎麽用?Java KeyboardView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


KeyboardView類屬於android.inputmethodservice包,在下文中一共展示了KeyboardView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: NumberKeyboard

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public NumberKeyboard(final Context context, OnKeyActionListener keyActionListener) {
    super(context, keyActionListener);

    final View contentView = setContentView(R.layout.keyboard_plate);

    mKeyboard = new Keyboard(context, R.xml.keyboardnumber);

    mKeyboardView = (KeyboardView) contentView.findViewById(R.id.keyboard_view);
    mKeyboardView.setOnKeyboardActionListener(new OnKeyboardActionHandler() {
        @Override
        public void onKey(int charCode, int[] keyCodes) {
            if (charCode == Keyboard.KEYCODE_DONE) {
                dismiss();
                return;
            }
            mOnKeyActionListener.onProcess(charCode);
        }
    });
    mKeyboardView.setPreviewEnabled(false);// !!! Must be false
    mKeyboardView.setKeyboard(mKeyboard);
}
 
開發者ID:shangxiazuoyou,項目名稱:NumberKeyboard,代碼行數:22,代碼來源:NumberKeyboard.java

示例2: VinKeyboardUtil

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public VinKeyboardUtil(Context ctx, View view, EditText edit) {
    this.ctx = ctx;
    this.edit = edit;
    this.editString = edit.getText().toString();
    this.edit.setSelection(editString.length());

    k2 = new Keyboard(ctx, R.xml.lettersanddigit_keyboard);

    keyboardView = (KeyboardView) view.findViewById(R.id.keyboard_view);

    keyboardView.setKeyboard(k2);
    keyboardView.setEnabled(true);
    //設置為true時,當按下一個按鍵時會有一個popup來顯示<key>元素設置的android:popupCharacters=""
    keyboardView.setPreviewEnabled(false);
    //設置鍵盤按鍵監聽器
    keyboardView.setOnKeyboardActionListener(listener);

    letterAndDigit = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
            , "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"
            , "A", "S", "D", "F", "G", "H", "J", "K", "L"
            , "Z", "X", "C", "V", "B", "N", "M"};
}
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:23,代碼來源:VinKeyboardUtil.java

示例3: MyKeyboard

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public MyKeyboard( Context context, KeyboardView view, int kbdid1, int kbdid2 )
{
  // FIXME DIALOG super( context );
  mContext = context;
  mEdit = null;
  mFlags = new HashMap< EditText, Integer >();

  // Log.v("DistoX", "id1 " + kbdid1 + " " + kbdid2 );
  mKeyboardView = view;
  mKeyboard1 = new Keyboard( mContext, kbdid1 );
  mKeyboard2 = ( kbdid2 == -1 )? null : new Keyboard( mContext, kbdid2 );
  mKeyboard  = mKeyboard1;
  mKeyboardView.setKeyboard(mKeyboard);
  mKeyboardView.setEnabled(true);
  mKeyboardView.setOnKeyListener(this);
  mKeyboardView.setOnKeyboardActionListener(this);
  mKeyboardView.setPreviewEnabled( false );
}
 
開發者ID:marcocorvi,項目名稱:topodroid,代碼行數:19,代碼來源:MyKeyboard.java

示例4: onCreateInputView

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
@Override
public View onCreateInputView() {
    initializeMedia();
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    qwertyKeyboard = new Keyboard(this, R.xml.qwerty);
    symbolsKeyboard = new Keyboard(this, R.xml.symbols);
    symShiftKeyboard = new Keyboard(this, R.xml.symbols_shift);

    kv = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
    kv.setKeyboard(qwertyKeyboard);
    kv.setOnKeyboardActionListener(this);
    return kv;
}
 
開發者ID:rollforbugs,項目名稱:lokey,代碼行數:15,代碼來源:IME.java

示例5: LicenseKeyboardUtil

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public LicenseKeyboardUtil(Context ctx, View view, EditText edits[]) {
    this.ctx = ctx;
    this.edits = edits;

    //禁用edits輸入屬性 即禁用光標
    for (int i = 0; i < edits.length; i++) {
        edits[i].setText("");
        edits[i].setInputType(InputType.TYPE_NULL);
    }


    k1 = new Keyboard(ctx, R.xml.province_short_keyboard);
    k2 = new Keyboard(ctx, R.xml.lettersanddigit_keyboard);

    keyboardView = (KeyboardView) view.findViewById(R.id.keyboard_view);

    keyboardView.setKeyboard(k1);
    keyboardView.setEnabled(true);
    //設置為true時,當按下一個按鍵時會有一個popup來顯示<key>元素設置的android:popupCharacters=""
    keyboardView.setPreviewEnabled(false);
    //設置鍵盤按鍵監聽器
    keyboardView.setOnKeyboardActionListener(listener);
    provinceShort = new String[]{"澳", "川", "鄂", "贛", "甘", "港", "桂", "貴", "黑"
            , "滬", "冀", "吉", "京", "津", "晉", "遼", "魯", "蒙"
            , "閩", "寧", "青", "瓊", "蘇", "陝", "台", "皖", "湘"
            , "新", "豫", "粵", "渝", "雲", "藏", "浙"};

    letterAndDigit = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
            , "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"
            , "A", "S", "D", "F", "G", "H", "J", "K", "L"
            , "Z", "X", "C", "V", "B", "N", "M"};
}
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:33,代碼來源:LicenseKeyboardUtil.java

示例6: KeyboardUtil

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public KeyboardUtil(Context context, Activity activity, EditText editText) {
    mContext = context;
    mActivity = activity;
    mEditText = editText;

    mNumberKeyboard = new Keyboard(mContext, R.xml.keyboard_numbers);
    mKeyboardView = (KeyboardView) mActivity.findViewById(R.id.keyboard_view);
    mKeyboardView.setKeyboard(mNumberKeyboard);
    mKeyboardView.setEnabled(true);
    mKeyboardView.setPreviewEnabled(true);
    mKeyboardView.setOnKeyboardActionListener(listener);
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:13,代碼來源:KeyboardUtil.java

示例7: onCreateInputView

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
@SuppressLint("InflateParams")
@Override
public View onCreateInputView() {
    mKeyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard, null);
    mCurrentLocale = Constants.KEYS_TYPE.RUSSIAN;
    mKeyboard = getKeyboard(mCurrentLocale);
    mKeyboard.setShifted(isCapsOn);
    mKeyboardView.setKeyboard(mKeyboard);
    mKeyboardView.setOnKeyboardActionListener(this);

    return mKeyboardView;
}
 
開發者ID:Medeuz,項目名稱:CustomAndroidKeyboard,代碼行數:13,代碼來源:SimpleIME.java

示例8: init

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
private void init() {

		// 隱藏係統鍵盤
		hideSysInput();

		initAttributes(context);

		numKeyboard = new Keyboard(context, R.layout.keyboard_symbols_md);

		keyboardView = (KeyboardView) LayoutInflater.from(context).inflate(
				R.layout.keyboard_view, null);
		keyboardView.setEnabled(true);
		keyboardView.setPreviewEnabled(false);
		keyboardView.setOnKeyboardActionListener(listener);

		mKeyboardWindow = new PopupWindow(keyboardView,
				ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.WRAP_CONTENT);
		mKeyboardWindow.setAnimationStyle(R.style.AnimationFade);
		mKeyboardWindow.setOnDismissListener(new OnDismissListener() {

			@Override
			public void onDismiss() {
				if (scrolldis > 0) {
					int temp = scrolldis;
					scrolldis = 0;
					if (null != mContentView) {
						mContentView.scrollBy(0, -temp);
					}
				}
			}
		});
	}
 
開發者ID:luoxianli,項目名稱:GridPassword,代碼行數:34,代碼來源:CustomBoardEditText.java

示例9: onCreateInputView

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
@Override
public View onCreateInputView() {
    if (!ViewConfiguration.get(getApplicationContext()).hasPermanentMenuKey())
        return new KeyboardView(this, null);
    KeyboardView ret = new KeyboardView(this, null);
    ret.setKeyboard(new Keyboard(this, R.xml.keyboarddef));
    ret.setOnKeyboardActionListener(this);
    ret.setPreviewEnabled(false);
    return ret;
}
 
開發者ID:Viovie-com,項目名稱:webkeyboard,代碼行數:11,代碼來源:RemoteKeyboardService.java

示例10: KeyboardHelper

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public KeyboardHelper(Activity mActivity, EditText editText) {
    keyboardWindow = createKeyboardWindow(mActivity.getApplicationContext());
    keyboardWindow.setOnDismissListener(this);
    keyboardView = (KeyboardView) keyboardWindow.getContentView().findViewById(R.id.keyboard_view);
    keyboardLayout = keyboardWindow.getContentView().findViewById(R.id.keyboard_view_layout);
    initKeyboar(mActivity);
    addEditText(editText);
}
 
開發者ID:beilly,項目名稱:randomkeyboard,代碼行數:9,代碼來源:KeyboardHelper.java

示例11: onCreateInputView

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
/**
 * Called by the framework when your view for creating input needs to
 * be generated.  This will be called the first time your input method
 * is displayed, and every time it needs to be re-created such as due to
 * a configuration change.
 */
@Override public View onCreateInputView() {
    mInputView = (KeyboardView) getLayoutInflater().inflate(
            R.layout.input, null);
    mInputView.setOnKeyboardActionListener(this);
    mInputView.setKeyboard(mQwertyKeyboard);
    return mInputView;
}
 
開發者ID:divec,項目名稱:literatim,代碼行數:14,代碼來源:SoftKeyboard.java

示例12: onCreateInputView

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
@Override
public View onCreateInputView() {
    mInputView = (KeyboardView) getLayoutInflater().inflate(
            R.layout.input, null);
    mInputView.setOnKeyboardActionListener(this);
    mInputView.setKeyboard(mQwertyKeyboard);
    return mInputView;
}
 
開發者ID:singwhatiwanna,項目名稱:TinyIme,代碼行數:9,代碼來源:ImeService.java

示例13: SecKeyboardView

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
public SecKeyboardView(Activity act, final EditText editText, KeyboardView keyboardView) {

        this.mActivity = act;
        this.ed = editText;
        this.mKeyboardView = keyboardView;

        k1 = new Keyboard(mActivity, R.xml.qwerty);
        k2 = new Keyboard(mActivity, R.xml.symbols);

        mImm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);

        mKeyboardView.setKeyboard(k1);
        mKeyboardView.setEnabled(true);
        mKeyboardView.setPreviewEnabled(false);
        mKeyboardView.setOnKeyboardActionListener(listener);

        editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean b) {
                if (!b) {
                    hideKeyboard();
                } else {
                    mImm.hideSoftInputFromWindow(view.getWindowToken(), 0); //強製隱藏鍵盤
                }
            }
        });
        editText.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                int inputType = editText.getInputType();
                hideSoftInputMethod(editText);
                showKeyboard();
                editText.setInputType(inputType);
                return false;
            }
        });
    }
 
開發者ID:tangqifa,項目名稱:AndroidSecurityKeyboard,代碼行數:38,代碼來源:SecKeyboardView.java

示例14: onCreate

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mPassword = (EditText) findViewById(R.id.password_edit);
    mKeyboardView = (KeyboardView)findViewById(com.kejiwen.securitykeyboardlibrary.R.id.keyboard_view);
    new SecKeyboardView(this, mPassword,mKeyboardView);
}
 
開發者ID:tangqifa,項目名稱:AndroidSecurityKeyboard,代碼行數:9,代碼來源:MainActivityDemo.java

示例15: onCreate

import android.inputmethodservice.KeyboardView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) 
{
  super.onCreate(savedInstanceState);

  initLayout( R.layout.station_search_dialog, R.string.title_station_search );

  mName = (EditText) findViewById( R.id.name );
  mName.setOnLongClickListener( this );
  if ( mStation != null ) mName.setText( mStation );

  mBtnSplays = (CheckBox) findViewById(R.id.splays);
  // mBtnSplays.setVisibility( View.GONE ); 

  mBtnSearch = (Button) findViewById(R.id.btn_search);
  mBtnCancel = (Button) findViewById(R.id.btn_cancel);

  mBtnSearch.setOnClickListener( this ); // SEARCH
  mBtnCancel.setOnClickListener( this ); // CANCEL

  mKeyboard = new MyKeyboard( mContext, (KeyboardView)findViewById( R.id.keyboardview ), 
                              R.xml.my_keyboard_base_sign, R.xml.my_keyboard_qwerty );
  if ( TDSetting.mKeyboard ) {
    int flag = MyKeyboard.FLAG_POINT_LCASE_2ND;
    if ( TDSetting.mStationNames == 1 ) flag = MyKeyboard.FLAG_POINT;
    MyKeyboard.registerEditText( mKeyboard, mName, flag);
  } else {
    mKeyboard.hide();
    if ( TDSetting.mStationNames == 1 ) {
      mName.setInputType( TDConst.NUMBER_DECIMAL );
    }
  }
}
 
開發者ID:marcocorvi,項目名稱:topodroid,代碼行數:34,代碼來源:StationSearchDialog.java


注:本文中的android.inputmethodservice.KeyboardView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。