本文整理匯總了Java中android.inputmethodservice.KeyboardView.setKeyboard方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyboardView.setKeyboard方法的具體用法?Java KeyboardView.setKeyboard怎麽用?Java KeyboardView.setKeyboard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.inputmethodservice.KeyboardView
的用法示例。
在下文中一共展示了KeyboardView.setKeyboard方法的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);
}
示例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"};
}
示例3: 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;
}
示例4: 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"};
}
示例5: 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);
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: KeyboardUtil
import android.inputmethodservice.KeyboardView; //導入方法依賴的package包/類
public KeyboardUtil(Activity act, Context ctx, EditText edit,
String typemode) {
this.ctx = ctx;
this.ed = edit;
this.act = act;
this.typemode = typemode;
k2 = new Keyboard(ctx, R.xml.symbols_num);
keyboardView = (KeyboardView) act.findViewById(R.id.keyboard_view);
keyboardView.setEnabled(true);
keyboardView.setKeyboard(k2);
keyboardView.setPreviewEnabled(false);
keyboardView.setOnKeyboardActionListener(listener);
}
示例11: onCreateInputView
import android.inputmethodservice.KeyboardView; //導入方法依賴的package包/類
@Override
public View onCreateInputView() {
// Log.d("RemoteKeyboardService", "onCreateInputView connected=" + RemoteKeyboardPlugin.isConnected());
inputView = new KeyboardView(this, null);
inputView.setKeyboard(new Keyboard(this, R.xml.remotekeyboardplugin_keyboard));
inputView.setPreviewEnabled(false);
inputView.setOnKeyboardActionListener(this);
updateInputView();
return inputView;
}
示例12: onCreateInputView
import android.inputmethodservice.KeyboardView; //導入方法依賴的package包/類
@Override
public View onCreateInputView() {
KeyboardView ret = new KeyboardView(this, null);
ret.setKeyboard(new Keyboard(this, R.xml.keyboarddef));
ret.setOnKeyboardActionListener(this);
ret.setPreviewEnabled(false);
return ret;
}
示例13: onCreate
import android.inputmethodservice.KeyboardView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pin);
pinCodeView = (PinCodeView) findViewById(R.id.pin_code_view);
locationTextView = (TextView) findViewById(R.id.location_text_view);
countdownTextView = (TextView) findViewById(R.id.countdown_text_view);
alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
locationBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.hasExtra(LocationService.EXTRA_GEOCODE)) {
String s = intent.getStringExtra(LocationService.EXTRA_GEOCODE);
locationTextView.setText(s);
}
}
};
KeyboardView keyboardView = (KeyboardView) findViewById(R.id.keyboard_view);
keyboardView.setPreviewEnabled(false);
keyboardView.setOnKeyboardActionListener(this);
keyboardView.setKeyboard(new Keyboard(this, R.xml.keyboard));
int flags = WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
visibility |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getWindow().addFlags(flags);
getWindow().getDecorView().setSystemUiVisibility(visibility);
final int finalVisibility = visibility;
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int v) {
// Torna sempre in modalità fullscreen
if ((v & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
getWindow().getDecorView().setSystemUiVisibility(finalVisibility);
}
});
savedPin = CustodeUtils.getSavedPin(this);
countDownTimer = new PinCountDownTimer();
countDownTimer.start();
scheduleSystemAlarm();
}
示例14: initKeyboard
import android.inputmethodservice.KeyboardView; //導入方法依賴的package包/類
private void initKeyboard() {
keyboard = new Keyboard(this, R.xml.keyboard);
keyboardView = (KeyboardView) findViewById(R.id.keyboardview);
keyboardView.setKeyboard(keyboard);
keyboardView.setPreviewEnabled(false);
OnKeyboardActionListener mOnKeyboardActionListener = new OnKeyboardActionListener() {
@Override
public void onKey(int code, int[] keyCodes) {
String str = textForKeyboard.getText().toString();
switch (code) {
case Constants.KEY_CODE_BACK:
if (!str.isEmpty()) {
textForKeyboard.setText(str.substring(0,
str.length() - 1));
}
break;
case Constants.KEY_CODE_ENTER:
checkAnswer(str);
break;
default:
if (str.length() < sNumberlength) {
textForKeyboard.setText(str + code);
}
}
}
@Override
public void onPress(int arg0) {
}
@Override
public void onRelease(int primaryCode) {
}
@Override
public void onText(CharSequence text) {
}
@Override
public void swipeDown() {
}
@Override
public void swipeLeft() {
}
@Override
public void swipeRight() {
}
@Override
public void swipeUp() {
}
};
keyboardView.setOnKeyboardActionListener(mOnKeyboardActionListener);
openKeyboard();
}
示例15: onCreateInputView
import android.inputmethodservice.KeyboardView; //導入方法依賴的package包/類
@Override public View onCreateInputView() {
InputView = (KeyboardView) getLayoutInflater().inflate(R.layout.input, null);
InputView.setOnKeyboardActionListener(this);
InputView.setKeyboard(BAGOQwertyKeyboard);
return InputView;
}