本文整理汇总了Java中android.widget.TextView.setOnFocusChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setOnFocusChangeListener方法的具体用法?Java TextView.setOnFocusChangeListener怎么用?Java TextView.setOnFocusChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setOnFocusChangeListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFinishInflate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
final Context context = getContext();
textView = (TextView) getChildAt(0);
textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
textView.setHintTextColor(lessSignificantColor);
textView.setHorizontalFadingEdgeEnabled(true);
textView.setSingleLine();
setValidateAmount(textView instanceof EditText);
textView.addTextChangedListener(textViewListener);
textView.setOnFocusChangeListener(textViewListener);
contextButton = new View(context) {
@Override
protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) {
setMeasuredDimension(textView.getCompoundPaddingRight(), textView.getMeasuredHeight());
}
};
final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
chooseViewParams.gravity = Gravity.RIGHT;
contextButton.setLayoutParams(chooseViewParams);
this.addView(contextButton);
updateAppearance();
}
示例2: resetLayout
import android.widget.TextView; //导入方法依赖的package包/类
void resetLayout() {
mContent.removeAllViewsInLayout();
if (!FeatureFlags.NO_ALL_APPS_ICON) {
// Add the Apps button
Context context = getContext();
int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank();
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);
int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
Rect bounds = d.getBounds();
d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
bounds.bottom - scaleDownPx / 2);
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(allAppsButtonRank);
int y = getCellYFromOrder(allAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
}
示例3: resetLayout
import android.widget.TextView; //导入方法依赖的package包/类
void resetLayout() {
mContent.removeAllViewsInLayout();
// 在hotseat中显示进入所有应用列表的图标
if (!FeatureFlags.NO_ALL_APPS_ICON) {
// Add the Apps button
Context context = getContext();
int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank();
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);
int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
Rect bounds = d.getBounds();
d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
bounds.bottom - scaleDownPx / 2);
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(allAppsButtonRank);
int y = getCellYFromOrder(allAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
}