本文整理匯總了Java中android.view.View.isFocusableInTouchMode方法的典型用法代碼示例。如果您正苦於以下問題:Java View.isFocusableInTouchMode方法的具體用法?Java View.isFocusableInTouchMode怎麽用?Java View.isFocusableInTouchMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.isFocusableInTouchMode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findClickableViewInChild
import android.view.View; //導入方法依賴的package包/類
private boolean findClickableViewInChild(View view, int x, int y) {
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View child = viewGroup.getChildAt(i);
final Rect rect = new Rect();
child.getHitRect(rect);
final boolean contains = rect.contains(x, y);
if (contains) {
return findClickableViewInChild(child, x - rect.left, y - rect.top);
}
}
} else if (view != childView) {
return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
}
return view.isFocusableInTouchMode();
}
示例2: findClickableViewInChild
import android.view.View; //導入方法依賴的package包/類
private boolean findClickableViewInChild(View view, int x, int y) {
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View child = viewGroup.getChildAt(i);
Rect rect = new Rect();
child.getHitRect(rect);
if (rect.contains(x, y)) {
return findClickableViewInChild(child, x - rect.left, y - rect.top);
}
}
} else if (view != this.childView) {
return view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode());
}
return view.isFocusableInTouchMode();
}
示例3: run
import android.view.View; //導入方法依賴的package包/類
@Override
public void run() {
if (tries <= 0) {
return;
}
final View view = viewReferemce.get();
if (view == null) {
// The view is gone. No need to continue.
return;
}
if (!view.isFocusable() || !view.isFocusableInTouchMode()) {
// The view is not focusable - we can't show the keyboard for it.
return;
}
if (!view.requestFocus()) {
// Focus this view first.
post();
return;
}
final Activity activity = (Activity) view.getContext();
if (activity == null) {
return;
}
final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm == null) {
return;
}
if (!imm.isActive(view)) {
// This view is not the currently active view for the input method yet.
post();
return;
}
if (!imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)) {
// Showing they keyboard failed. Try again later.
post();
}
}