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


Java View.setFocusableInTouchMode方法代码示例

本文整理汇总了Java中android.view.View.setFocusableInTouchMode方法的典型用法代码示例。如果您正苦于以下问题:Java View.setFocusableInTouchMode方法的具体用法?Java View.setFocusableInTouchMode怎么用?Java View.setFocusableInTouchMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.setFocusableInTouchMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: disable

import android.view.View; //导入方法依赖的package包/类
/**
 * Helper function to disable a ViewGroup and all it's children. This draws a new view with z-ordering of integer max
 * that consumes all touch events.
 * @param viewGroup
 */
public static void disable(ViewGroup viewGroup){
    View view = new View(viewGroup.getContext());
    viewGroup.addView(view);
    view.setTag(DISABLE);

    ViewGroup.LayoutParams params = view.getLayoutParams();
    params.height = MATCH_PARENT;
    params.width = MATCH_PARENT;
    view.setLayoutParams(params);

    view.setClickable(true);
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(Color.TRANSPARENT);

    if (Build.VERSION.SDK_INT >= 21) {
        view.setTranslationZ(Integer.MAX_VALUE);
    }
    viewGroup.bringChildToFront(view);
}
 
开发者ID:kevinwang5658,项目名称:backstack,代码行数:26,代码来源:Helper.java

示例2: isShouldHideInput

import android.view.View; //导入方法依赖的package包/类
public boolean isShouldHideInput(View v, MotionEvent event) {
        if (v != null && (v instanceof EditText)) {
            int[] leftTop = {0, 0};
            //获取输入框当前的location位置
            v.getLocationInWindow(leftTop);
            int left = leftTop[0];
            int top = leftTop[1];
            int bottom = top + v.getHeight();
            int right = left + v.getWidth();
            if (event.getX() > left && event.getX() < right
                    && event.getY() > top && event.getY() < bottom) {
                // 点击的是输入框区域,保留点击EditText的事件
                return false;
            } else {
                //使EditText触发一次失去焦点事件
                v.setFocusable(false);
//                v.setFocusable(true); //这里不需要是因为下面一句代码会同时实现这个功能
                v.setFocusableInTouchMode(true);
                return true;
            }
        }
        return false;
    }
 
开发者ID:wendyltan,项目名称:EasyTodo,代码行数:24,代码来源:EventContentActivity.java

示例3: showSoftInput

import android.view.View; //导入方法依赖的package包/类
/**
 * Dynamic display soft keyboard
 *
 * @param view view
 */
public static void showSoftInput(Context context, final View view) {
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.requestFocus();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm == null)
        return;
    imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:15,代码来源:KeyboardUtils.java

示例4: setViewFocus

import android.view.View; //导入方法依赖的package包/类
public void setViewFocus(View view) {
    if (view != null) {
        view.setFocusable(true);
        view.setFocusableInTouchMode(true);
        view.requestFocus();
        view.requestFocusFromTouch();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:BasicActivity.java

示例5: showSoftKeyboard

import android.view.View; //导入方法依赖的package包/类
public static void showSoftKeyboard(View view) {
    if (view == null) {
        return;
    }
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    if (!view.isFocused()) {
        view.requestFocus();
    }

    InputMethodManager inputMethodManager = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showSoftInput(view, 0);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:15,代码来源:TDevice.java

示例6: setEditFocusable

import android.view.View; //导入方法依赖的package包/类
/**
 * 弹出输入法
 *
 * @param context context
 * @param view    编辑控件
 */
public static void setEditFocusable(final Context context, final View view) {
    view.setFocusableInTouchMode(true);
    view.requestFocus();
    InputMethodManager inputMethodManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showSoftInput(view, 0);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SoftInputUtils.java

示例7: showSoftInput

import android.view.View; //导入方法依赖的package包/类
/**
 * 动态显示软键盘
 *
 * @param view 视图
 */
public static void showSoftInput(final View view) {
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.requestFocus();
    InputMethodManager imm = (InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm == null) return;
    imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:KeyboardUtils.java

示例8: openKeyboard

import android.view.View; //导入方法依赖的package包/类
@Override
public void openKeyboard(View view) {
    if(mInputManager != null) {
        view.setFocusableInTouchMode(true);
        view.requestFocus();
        mInputManager.showSoftInput(view, InputMethodManager.SHOW_FORCED);
    }
}
 
开发者ID:nickyangjun,项目名称:EasyEmoji,代码行数:9,代码来源:KeyboardManagerImpl.java

示例9: onBackPressed

import android.view.View; //导入方法依赖的package包/类
private void onBackPressed(View view) {
    view.setFocusableInTouchMode(true);
    view.setOnKeyListener((v, keyCode, event) -> {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
            new AlertDialog.Builder(getActivity())
                    .setTitle("Leave")
                    .setMessage("Exit the watch screen?")
                    .setPositiveButton("Yes", (dialog, id) -> getActivity().finish())
                    .setNegativeButton("No", null)
                    .show();
            return true;
        }
        return false;
    });
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:16,代码来源:SlotBankerFragment.java

示例10: requestChildFocus

import android.view.View; //导入方法依赖的package包/类
@Override
public void requestChildFocus(View child, View focused) {
    super.requestChildFocus(child, focused);
    dispatchChildFocus(mChildrenFocused && focused != null);
    if (focused != null) {
        focused.setFocusableInTouchMode(false);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:9,代码来源:LauncherAppWidgetHostView.java

示例11: showSoftInput

import android.view.View; //导入方法依赖的package包/类
/**
 * 动态显示软键盘
 *
 * @param view 视图
 */
public static void showSoftInput(Context context, final View view) {
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.requestFocus();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm == null) {
        return;
    }
    imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
 
开发者ID:xiaobailong24,项目名称:MVVMArms,代码行数:16,代码来源:KeyboardUtils.java

示例12: showInputKeyboard

import android.view.View; //导入方法依赖的package包/类
/**
 * 弹出键盘
 *
 * @param et
 */
public static void showInputKeyboard(View et) {
    et.setFocusable(true);
    et.setFocusableInTouchMode(true);
    et.requestFocus();
    InputMethodManager imm = (InputMethodManager) AppUtil.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(et, 0);
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:13,代码来源:DeviceUtil.java

示例13: obtainFocus

import android.view.View; //导入方法依赖的package包/类
/**
 * request focus for target view
 * @param v the target view.
 */
public static void obtainFocus(View v) {
    if (v != null) {
        v.setFocusable(true);
        v.setFocusableInTouchMode(true);
        v.requestFocus();
        v.requestFocusFromTouch();
    }
}
 
开发者ID:LightSun,项目名称:android-util2,代码行数:13,代码来源:ViewUtil.java

示例14: showSoftInput

import android.view.View; //导入方法依赖的package包/类
/**
 * 动态显示软键盘
 * {@link InputMethodManager#showSoftInput(View, int)}
 *
 * @param view 视图
 */
public static void showSoftInput(@NonNull View view) {
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.requestFocus();
    getInputMethodManager().showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:13,代码来源:KeyBoardUtil.java

示例15: showSoftInput

import android.view.View; //导入方法依赖的package包/类
/**
 * 动态显示软键盘
 *
 * @param context 上下文
 * @param view 视图
 */
public static void showSoftInput(Context context, final View view) {
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.requestFocus();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm == null) return;
    imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
 
开发者ID:senierr,项目名称:ModuleFrame,代码行数:15,代码来源:KeyboardUtil.java


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