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

网络推广的网站有哪些影响网站排名的因素 权重

网络推广的网站有哪些,影响网站排名的因素 权重,网站专栏建设方案,广告营销策略思路#xff1a; 要在 Android 应用中全局检测软键盘的弹起#xff0c;您可以使用 ViewTreeObserver.OnGlobalLayoutListener 监听器来监听布局树的变化。当软键盘弹起或隐藏时#xff0c;布局树会发生变化#xff0c;因此您可以在监听器中捕获这些变化。 以下是一个示例…思路 要在 Android 应用中全局检测软键盘的弹起您可以使用 ViewTreeObserver.OnGlobalLayoutListener 监听器来监听布局树的变化。当软键盘弹起或隐藏时布局树会发生变化因此您可以在监听器中捕获这些变化。 以下是一个示例展示如何在全局范围内检测软键盘的弹起 import android.graphics.Rect; import android.os.Bundle; import android.view.View; import android.view.ViewTreeObserver; import androidx.appcompat.app.AppCompatActivity;public class MainActivity extends AppCompatActivity {private View rootView;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);rootView findViewById(R.id.rootView); // Replace with your root layouts ID// Register a global layout listenerrootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {Overridepublic void onGlobalLayout() {// Get the height of the visible display areaRect rect new Rect();rootView.getWindowVisibleDisplayFrame(rect);int screenHeight rootView.getHeight();int keyboardHeight screenHeight - rect.bottom;// If the keyboard height is greater than a threshold (e.g., 100 pixels), the keyboard is likely visibleif (keyboardHeight 100) {// Keyboard is visible, do something} else {// Keyboard is hidden, do something else}}});} }在上面的代码中rootView 是您布局的根视图您需要将其替换为您实际布局的根视图。addOnGlobalLayoutListener 方法用于注册一个监听器当布局树发生变化时会调用 onGlobalLayout 方法。 在 onGlobalLayout 方法中您可以通过比较屏幕高度和可见区域的底部位置来计算软键盘的高度。根据计算结果您可以判断软键盘是否可见并执行相应的操作。 以下是一个在项目中的实际示例解决无限循环的示例 private void changerBottomView() {binding.includedNoteMenu.fragmentLl.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener); }private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener new ViewTreeObserver.OnGlobalLayoutListener() {Overridepublic void onGlobalLayout() {Rect rect new Rect();//取得 rootView 可视区域binding.includedNoteMenu.fragmentLl.getWindowVisibleDisplayFrame(rect);//取得 rootView 不可视区域高度 (被其他View遮挡的区域高度)int rootInvisibleHeight binding.includedNoteMenu.fragmentLl.getRootView().getHeight() - rect.bottom;LogUtil.i(shawn,rootInvisibleHeight rootInvisibleHeight);ViewGroup.MarginLayoutParams layoutParams (ViewGroup.MarginLayoutParams)binding.includedNoteMenu.fragmentLl.getLayoutParams();if (layoutParams.bottomMargin ! rootInvisibleHeight UiUtil.dp2px(10)) {layoutParams.bottomMargin rootInvisibleHeight UiUtil.dp2px(10);binding.includedNoteMenu.fragmentLl.setLayoutParams(layoutParams);}}}; 日志 只会多调用一次在第二次回调时条件已不满足不会再调用setLayoutParams I/shawn: [ main: AddNoteFragment.java:173 onGlobalLayout ] - rootInvisibleHeight 840 I/shawn: [ main: AddNoteFragment.java:173 onGlobalLayout ] - rootInvisibleHeight 840 I/shawn: [ main: AddNoteFragment.java:173 onGlobalLayout ] - rootInvisibleHeight -4 I/shawn: [ main: AddNoteFragment.java:173 onGlobalLayout ] - rootInvisibleHeight -4
http://wiki.neutronadmin.com/news/346223/

相关文章:

  • 西宁网站建设哪家好app小程序定制
  • 网站建设有哪些岗位职责新乡网站建设哪家专业
  • 网站域名解析到了空间 但空间未绑定此域名四川长昕建设工程有限公司网站
  • 怎样批量做全国网站logo网站设计素材
  • edu域名网站上海有哪些软件公司
  • 关于网站建设的博客wordpress如何删除永久链接
  • 网站搭建关键词排名网站上删除信息如何做
  • 优异网站申请了域名 网站怎么建设呢
  • 网站群集建设河北省建设机械会网站
  • 北京市建设教育协会网站首页海淘手表网站
  • 如何做网站文件石家庄网站设计制作
  • pc网站建设怎么弄软件商店oppo官方下载
  • 东莞品牌网站制作公司视频工厂网站建设
  • dede网站名称不能中文长沙房地产网站设计
  • 中国建设招标网是什么网站wordpress 授权登录页面
  • 安陆建设局网站如何使用阿里云建设网站
  • 南通网站建设系统主机屋 建网站教程
  • 重庆高端网站制作上海到北京高铁最快2个小时
  • 桂林做网站建设的公司南充网站建设
  • 站长之家的作用柳州seo培训
  • 网站后台管理的超链接怎么做免费发布广告信息网
  • 网站建设公司口碑排名合肥网站建设的价格
  • wordpress优惠码广州做seo整站优化公司
  • 福建龙岩网站制作公司网络组建论文
  • 查外链网站企业查询电话号码
  • 专业建站公司建站系统北京网站建设hj华网天下
  • 深圳建设网站速成班网站友情链接是什么
  • 做网站需要啥中铁三局招聘学历要求
  • 广州中新知识城开发建设网站客厅装修效果图片大全
  • 青岛主流网站互联网公司营业执照经营范围