当前位置: 首页>>代码示例>>Java>>正文


Java View.isFocusableInTouchMode方法代码示例

本文整理汇总了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();
}
 
开发者ID:yangchong211,项目名称:YCUtils,代码行数:20,代码来源:MaterialRippleLayout.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:MaterialRippleLayout.java

示例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();
    }
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:45,代码来源:ViewUtils.java


注:本文中的android.view.View.isFocusableInTouchMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。