当前位置: 首页 > news >正文

主流网站宽度网站建设功能介绍

主流网站宽度,网站建设功能介绍,seo教程最新,济南手机建站价格文章目录 Android 软键盘的显示和隐藏核心方法软键盘工具类点击空白区域隐藏软键盘方式一方式二 Android 软键盘的显示和隐藏 核心方法 显示软键盘#xff1a; InputMethodManager#showSoftInput(View view, int flags)隐藏软键盘#xff1a; InputMethodManager#hideSof… 文章目录 Android 软键盘的显示和隐藏核心方法软键盘工具类点击空白区域隐藏软键盘方式一方式二 Android 软键盘的显示和隐藏 核心方法 显示软键盘 InputMethodManager#showSoftInput(View view, int flags)隐藏软键盘 InputMethodManager#hideSoftInputFromWindow(IBinder windowToken, int flags)flags操作标志 flags0SHOW_IMPLICITSHOW_FORCED0YYYHIDE_IMPLICIT_ONLYNYNHIDE_NOT_ALWAYSYYN 先弹出软键盘再隐藏软键盘Y 表示软键盘隐藏N 表示软件不能隐藏。 SHOW_IMPLICIT隐式弹窗键盘表示弹出键盘不是由用户直接发起的键盘可能不会弹出。 SHOW_FORCED强制弹出键盘表示弹出键盘是用户直接发起的在用户请求收起键盘前软键盘会一直显示。 HIDE_IMPLICIT_ONLY只有通过 SHOW_IMPLICIT 弹出的键盘才能被隐藏。 HIDE_NOT_ALWAYS表示只要不是通过 SHOW_FORCED 弹出的键盘都会被隐藏。 调用 SHOW_FORCED 可以保证软键盘一定会弹出调用 0 可以保证软键盘一定会隐藏。 也可以简单粗暴的将两个方法中的 flag 都设为 0。 软键盘工具类 /*** 软键盘工具类*/ public class KeyboardUtils {/*** 显示软键盘** param editText*/public static void showSoftInput(EditText editText) {if (editText null)return;InputMethodManager imm (InputMethodManager) BaseApplication.getInstance().getSystemService(Context.INPUT_METHOD_SERVICE);if (imm null)return;editText.setFocusable(true);editText.setFocusableInTouchMode(true);editText.requestFocus();imm.showSoftInput(editText, 0);}/*** 隐藏软键盘** param view*/public static void hideSoftInput(View view) {if (view null)return;InputMethodManager inputMethodManager (InputMethodManager) BaseApplication.getInstance().getSystemService(Context.INPUT_METHOD_SERVICE);if (inputMethodManager null)return;inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);}/*** 隐藏软键盘** param editText*/public static void hideSoftInput(EditText editText) {if (editText null)return;InputMethodManager inputMethodManager (InputMethodManager) BaseApplication.getInstance().getSystemService(Context.INPUT_METHOD_SERVICE);if (inputMethodManager null)return;editText.clearFocus();inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), 0);}/*** 隐藏软键盘** param activity*/public static void hideSoftInput(Activity activity) {Window window activity.getWindow();View view window.getCurrentFocus();if (view null) {view window.getDecorView();}hideSoftInput(view);}/*** 软键盘切换*/public static void toggleSoftInput() {InputMethodManager imm (InputMethodManager) BaseApplication.getInstance().getSystemService(Context.INPUT_METHOD_SERVICE);if (imm null)return;imm.toggleSoftInput(0, 0);}}点击空白区域隐藏软键盘 方式一 public class BaseActivity extends AppCompatActivity {Overridepublic boolean onTouchEvent(MotionEvent event) {if (getCurrentFocus() ! null) {InputMethodManager mInputMethodManager (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);if (mInputMethodManager ! null) {return mInputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);}}return super.onTouchEvent(event);} }方式二 public class BaseActivity extends AppCompatActivity {// Override // public boolean onTouchEvent(MotionEvent event) { // if (getCurrentFocus() ! null) { // InputMethodManager mInputMethodManager (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); // if (mInputMethodManager ! null) { // return mInputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); // } // } // return super.onTouchEvent(event); // }Overridepublic boolean dispatchTouchEvent(MotionEvent ev) {if (ev.getAction() MotionEvent.ACTION_DOWN) {View view getCurrentFocus();if (isShouldHideKeyboard(view, ev)) {KeyboardUtils.hideSoftInput(view);}}return super.dispatchTouchEvent(ev);}/*** 是否隐藏软键盘*/private boolean isShouldHideKeyboard(View v, MotionEvent event) {if (v ! null v instanceof EditText) {int[] location {0, 0};v.getLocationInWindow(location);int left location[0];int top location[1];int right left v.getWidth();int bottom top v.getHeight();return !(event.getX() left event.getY() right event.getY() top event.getY() bottom);}return false;} }
http://www.pierceye.com/news/390260/

相关文章:

  • 阿里云 建设网站怎么样百度推广一级代理商名单
  • 湛江网站制作网站吉林省四平市网站建设
  • 酒店网站建设公司推广方法有哪些
  • 网站建设免备案免费空间wordpress在线教育主题购买
  • 网站后台验证码不显示成都市建设工程施工安监站网站
  • 榆林网站优化做图的网站
  • 在微信中做网站淄博 网站seo优化
  • 黑龙江省建设协会网站首页怎么用word做网站
  • 企业网站网站建设价格wordpress阶梯插件
  • 企业品牌建设方案范文roseonly企业网站优化
  • 电影资源采集网站咋做在百度上怎么建立网站吗
  • 好的企业网站设计方案中小企业网站建设 论文
  • 毕设网站建设论文网站开发合同履约
  • 织梦贷款网站源码备案过的网站换域名
  • 南宁网站seo顾问广州正规的免费建站
  • 温州教育网站建设建网站 陕西牛人网络科技
  • 青岛网站建设eoe世界杯现场直播
  • com网站建设中社交app定制开发
  • 阅读网站建设简易做海报网站
  • 上海企业网站建设推荐wordpress登录插件
  • 做网站的人联系电话可做产品预售的网站
  • 内部网络网站怎么做微信公众号推文制作软件
  • 什么网站做adsense好酒店官方网站建设书
  • 国家城乡与住房建设部网站做海报有什么参考的网站
  • 建德营销型网站建设企业邮箱地址怎么填写
  • 网站建设规划书总结怎么写wordpress 菜单链接
  • 网站目录程序重庆市建筑工程造价信息网官网
  • WordPress上传后找不到seo优化工程师
  • wordpress登录界面插件如何优化培训方式
  • 贵州建网站网站怎么优化自己免费