本文整理了Java中android.widget.TextView.setOnKeyListener()
方法的一些代码示例,展示了TextView.setOnKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setOnKeyListener()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setOnKeyListener
暂无
代码示例来源:origin: libgdx/libgdx
Dialog createDialog () {
textView = createView(context);
textView.setOnKeyListener(this);
FrameLayout.LayoutParams textBoxLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
textView.setLayoutParams(textBoxLayoutParams);
textView.setFocusable(true);
textView.setFocusableInTouchMode(true);
textView.setImeOptions(textView.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
final FrameLayout layout = new FrameLayout(context);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
layout.setLayoutParams(layoutParams);
layout.addView(textView);
layout.setOnTouchListener(this);
dialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
dialog.setContentView(layout);
return dialog;
}
代码示例来源:origin: libgdx/libgdx
Dialog createDialog () {
textView = createView(context);
textView.setOnKeyListener(this);
FrameLayout.LayoutParams textBoxLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
textView.setLayoutParams(textBoxLayoutParams);
textView.setFocusable(true);
textView.setFocusableInTouchMode(true);
textView.setImeOptions(textView.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
final FrameLayout layout = new FrameLayout(context);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
layout.setLayoutParams(layoutParams);
layout.addView(textView);
layout.setOnTouchListener(this);
dialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
dialog.setContentView(layout);
return dialog;
}
代码示例来源:origin: iSoron/uhabits
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
mMinuteView = (TextView) view.findViewById(R.id.minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
mAmPmTextView.setOnKeyListener(keyboardListener);
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
mAmText = amPmTexts[0];
mDoneButton.setOnKeyListener(keyboardListener);
mClearButton.setOnKeyListener(keyboardListener);
代码示例来源:origin: wangdan/AisenWeiBo
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
mMinuteView = (TextView) view.findViewById(R.id.minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
mAmPmTextView.setOnKeyListener(keyboardListener);
if (Build.VERSION.SDK_INT <= 14) {
mDoneButton.setOnKeyListener(keyboardListener);
代码示例来源:origin: wdullaer/MaterialDateTimePicker
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = view.findViewById(R.id.mdtp_hour_space);
mMinuteSpaceView = view.findViewById(R.id.mdtp_minutes_space);
mMinuteView = view.findViewById(R.id.mdtp_minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mSecondSpaceView = view.findViewById(R.id.mdtp_seconds_space);
mSecondView = view.findViewById(R.id.mdtp_seconds);
mSecondView.setOnKeyListener(keyboardListener);
mAmTextView = view.findViewById(R.id.mdtp_am_label);
mAmTextView.setOnKeyListener(keyboardListener);
mPmTextView = view.findViewById(R.id.mdtp_pm_label);
mPmTextView.setOnKeyListener(keyboardListener);
mAmPmLayout = view.findViewById(R.id.mdtp_ampm_layout);
String[] amPmTexts = new DateFormatSymbols(mLocale).getAmPmStrings();
代码示例来源:origin: stackoverflow.com
});
tv.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
代码示例来源:origin: CiTuX/datetimepicker
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
mMinuteView = (TextView) view.findViewById(R.id.minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
mAmPmTextView.setOnKeyListener(keyboardListener);
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
mAmText = amPmTexts[0];
mDoneButton.setOnKeyListener(keyboardListener);
代码示例来源:origin: Kunzisoft/Android-SwitchDateTimePicker
mHourView.setOnKeyListener(keyboardListener);
mMinuteView.setOnKeyListener(keyboardListener);
mAmPmTextView.setOnKeyListener(keyboardListener);
代码示例来源:origin: fython/Blackbulb
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = view.findViewById(R.id.mdtp_hour_space);
mMinuteSpaceView = view.findViewById(R.id.mdtp_minutes_space);
mMinuteView = view.findViewById(R.id.mdtp_minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mSecondSpaceView = view.findViewById(R.id.mdtp_seconds_space);
mSecondView = view.findViewById(R.id.mdtp_seconds);
mSecondView.setOnKeyListener(keyboardListener);
mAmTextView = view.findViewById(R.id.mdtp_am_label);
mAmTextView.setOnKeyListener(keyboardListener);
mPmTextView = view.findViewById(R.id.mdtp_pm_label);
mPmTextView.setOnKeyListener(keyboardListener);
mAmPmLayout = view.findViewById(R.id.mdtp_ampm_layout);
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
代码示例来源:origin: henrichg/PhoneProfilesPlus
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
mMinuteView = (TextView) view.findViewById(R.id.minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
mAmPmTextView.setOnKeyListener(keyboardListener);
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
mAmText = amPmTexts[0];
代码示例来源:origin: alhazmy13/HijriDatePicker
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = (TextView) view.findViewById(R.id.mdtp_hour_space);
mMinuteSpaceView = (TextView) view.findViewById(R.id.mdtp_minutes_space);
mMinuteView = (TextView) view.findViewById(R.id.mdtp_minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mSecondSpaceView = (TextView) view.findViewById(R.id.mdtp_seconds_space);
mSecondView = (TextView) view.findViewById(R.id.mdtp_seconds);
mSecondView.setOnKeyListener(keyboardListener);
mAmTextView = (TextView) view.findViewById(R.id.mdtp_am_label);
mAmTextView.setOnKeyListener(keyboardListener);
mPmTextView = (TextView) view.findViewById(R.id.mdtp_pm_label);
mPmTextView.setOnKeyListener(keyboardListener);
mAmPmLayout = view.findViewById(R.id.mdtp_ampm_layout);
String[] amPmTexts = new DateFormatSymbols(mLocale).getAmPmStrings();
代码示例来源:origin: mohamad-amin/PersianMaterialDateTimePicker
mHourView.setOnKeyListener(keyboardListener);
mHourSpaceView = view.findViewById(R.id.hour_space);
mMinuteSpaceView = view.findViewById(R.id.minutes_space);
mMinuteView = view.findViewById(R.id.minutes);
mMinuteView.setOnKeyListener(keyboardListener);
mAmPmTextView = view.findViewById(R.id.ampm_label);
mOkButton = view.findViewById(R.id.ok);
mMinuteView.setTypeface(TypefaceHelper.get(activity, fontName));
mAmPmTextView.setTypeface(TypefaceHelper.get(activity, fontName));
mAmPmTextView.setOnKeyListener(keyboardListener);
mAmText = "قبلازظهر";
mPmText = "بعدازظهر";
代码示例来源:origin: fookwood/Launcher3
void resetLayout() {
mContent.removeAllViewsInLayout();
// Add the Apps button
Context context = getContext();
LayoutInflater inflater = LayoutInflater.from(context);
TextView allAppsButton = (TextView)
inflater.inflate(R.layout.all_apps_button, mContent, false);
Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
mLauncher.resizeIconDrawable(d);
allAppsButton.setCompoundDrawables(null, d, null, null);
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
if (mLauncher != null) {
mLauncher.setAllAppsButton(allAppsButton);
allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
allAppsButton.setOnClickListener(mLauncher);
allAppsButton.setOnLongClickListener(mLauncher);
allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
}
// Note: We do this to ensure that the hotseat is always laid out in the orientation of
// the hotseat in order regardless of which orientation they were added
int x = getCellXFromOrder(mAllAppsButtonRank);
int y = getCellYFromOrder(mAllAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
代码示例来源:origin: bkhezry/PersianDateRangePicker
mHourView.setOnKeyListener(keyboardListener);
mHourViewEnd = view.findViewById(R.id.hours_end_persian);
mHourViewEnd.setOnKeyListener(keyboardListener);
mHourSpaceView = view.findViewById(R.id.hour_space);
mHourSpaceViewEnd = view.findViewById(R.id.hour_space_end);
mMinuteSpaceViewEnd = view.findViewById(R.id.minutes_space_end);
mMinuteView = view.findViewById(R.id.minutes_persian);
mMinuteView.setOnKeyListener(keyboardListener);
mMinuteViewEnd = view.findViewById(R.id.minutes_end_persian);
mMinuteViewEnd.setOnKeyListener(keyboardListener);
mAmPmTextView = view.findViewById(R.id.ampm_label);
mAmPmTextView.setOnKeyListener(keyboardListener);
mAmPmTextViewEnd = view.findViewById(R.id.ampm_label_end);
mAmPmTextViewEnd.setOnKeyListener(keyboardListener);
if (fontName != null) {
mHourView.setTypeface(TypefaceHelper.get(activity, this.fontName));
代码示例来源:origin: jelic98/dynamico
.build();
textView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
内容来源于网络,如有侵权,请联系作者删除!