首页 文章 精选 留言 我的

精选列表

搜索[移动app],共10000篇文章
优秀的个人博客,低调大师

APP登陆页面适配

先看效果图。 登陆首页效果图 原理 为RootView增加监听事件,然后进行滚动 至于该滚动多少,这是需要自己慢慢进行计算。 xml <LinearLayout android:id="@+id/llLogin" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical"> <!--你的布局--> </LinearLayout> 代码 /** * 1、大于屏幕整体高度的1/3:键盘显示 获取Scroll的窗体坐标 * 算出main需要滚动的高度,使scroll显示。 * 2、小于屏幕整体高度的1/3:键盘隐藏 * * @param rootView 根布局 */ private fun addLayoutListener(rootView: View) { rootView.viewTreeObserver.addOnGlobalLayoutListener { val rect = Rect() rootView.getWindowVisibleDisplayFrame(rect) val screenHeight = rootView.rootView.height val mainInvisibleHeight = rootView.rootView.height - rect.bottom if (mainInvisibleHeight > screenHeight / 4) { rootView.scrollTo(0, DensityUtils.dp2px(mActivity, 200f/*需要滚动到图片目标高度*/)) } else { rootView.scrollTo(0, 0) } } }

优秀的个人博客,低调大师

Can't run app with devtools and java 9

Exception in thread "main" java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:93) at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:56) at org.springframework.boot.devtools.restart.Restarter.<init>(Restarter.java:139) at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:539) at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartedEvent(RestartApplicationListener.java:68) at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:45) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122) at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:67) at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176) at com.alibaba.microtek.Application.main(Application.java:17) https://github.com/spring-projects/spring-boot/issues/7565

优秀的个人博客,低调大师

APP中抽屉效果的项目讲解

导语 Android开发中,几乎我们在接触的项目中,多多少少都会需要用到PopupWindow来实现的弹出对话框,所以有必要熟悉掌握这个控件的使用 。这个控件其实使用起来并不是很难,如果自己亲自敲一个Demo 出来,我相信很快就可以上手的。下面 ,我将拿自己公司的项目来讲解一下我对于PopupWindow 的使用心得。 1、PopupWindow效果图 还是老习惯,讲一个新控件,先上效果图: 2、PopupWindow是什么? Android开发中常见的对话框有两种:AlertDialog 和 PopupWindow。它们的不同点在于:AlertDialog的位置固定在屏幕的中间,而PopupWindow的位置可以随意 。PopupWindow 这个类用来实现弹出框,可以把任意布局的View作为内容,而且这个弹出框是悬浮在当前Activity之上的。 3、PopupWindow 用法 创建PopupWindow构造方法有四种形式: public PopupWindow (Context context) public PopupWindow(View contentView) public PopupWindow(View contentView, int width, int height) public PopupWindow(View contentView, int width, int height, boolean focusable) 一般我的习惯是选择带有 3 个参数的构造方法 ,原因是PopupWindow是没有默认布局的,它的布局只有通过我们自己设置才行。而PopupWindow 的成功创建需要View contentView,int width, int height ,缺一个都不行 。刚好选择带有 3 个参数的构造方法,可以满足 。如果选择只有一个参数的需要单独设置宽度和搞定,代码如下: PopupWindow popupWindow = new PopupWindow(contentview); popupWindow.setWidth(LayoutParams.WRAP_CONTENT); popupWindow.setHeight(LayoutParams.WRAP_CONTENT); 构造参数的第一个参数contentview:是我们想要展示的内容 。一般我们是把内容写在一个xml布局里,加载的布局代码如下: View layoutLeft=LayoutInflater.from(getContext()).inflate(R.layout.pop_menulist, null); 构造参数的第二个参数width: 就是PopupWindow控件的宽度。构造参数的第三个参数height: 就是PopupWindow控件的高度。 除了构造方法很重要,还有个显示位置的函数也是很重要的,有3个 showAsDropDown(View anchor) showAsDropDown(View anchor, int xoff, int yoff) showAtLocation(View parent, int gravity, int x, int y) 第1个函数是没有偏移的,相对于布局中某个控件的位置(正左下方)第2个函数是有偏移的,相对某个控件的位置。xoff表示相对于X轴的偏移;yoff表示相对于Y轴的偏移。正负值表示方向。第3个函数跟第2个类似,不同的是这个是相对于父控件的位置 。 除了上面讲到的构造方法和显示函数是掌握 PopupWindow 的关键外,它还有几个常用的方法,比如:设置弹出对话框的动画效果:popupWindow.setAnimationStyle(R.style.PopupAnimation);获取焦点:popupWindow.setFocusable(true);对话框消失:popupWindow.dismiss();设置popupwindow外部可点击:popupWindow.setOutsideTouchable(true);设置背景透明:ColorDrawable cd = new ColorDrawable(0x00000000);popupWindow.setBackgroundDrawable(cd); 注意:设置popupwindow外部可点击的时候需要设置背景,不然外部点击的效果是不生效的 。在网络上,我有看到一个解释是这样的:如果有背景,则会在contentView外面包一层PopupViewContainer之后作为mPopupView,如果没有背景,则直接用contentView作为mPopupView。而这个PopupViewContainer是一个内部私有类,它继承了FrameLayout,在其中重写了Key和Touch事件的分发处理 。 4、PopupWindow的示例代码 因为有三个地方都需要用到 PopupWindow ,所以做成一个共用的方法,减少代码重复和冗余 ,有利于代码的复用 。由于这个项目是公司的项目,所以没法给大家搞出完整的代码,只能给出PopupWindow 的核心代码。 //设置条件弹出式方法 public void setConditionPopWindow() { layoutLeft = LayoutInflater.from(getContext()).inflate(R.layout.pop_menulist, null); mRecyclerView = (RecyclerView) layoutLeft .findViewById(R.id.rv_condition); conditonAdpter = new ConditionRAdapter(); conditonAdpter.addDatas(mdata);//添加数据 //1.上下文 2.方向 3.true代表倒序排列,flase代表顺序排 mRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false)); mRecyclerView.setAdapter(conditonAdpter); //设置适配器 mRecyclerView.setItemAnimator(new DefaultItemAnimator());//设置动画效果 popupWindow = new PopupWindow(layoutLeft, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); ColorDrawable cd = new ColorDrawable(0000); popupWindow.setBackgroundDrawable(cd); popupWindow.setAnimationStyle(R.style.PopupAnimation); popupWindow.update(); popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); popupWindow.setTouchable(true); // 设置popupwindow可点击 popupWindow.setOutsideTouchable(true); // 设置popupwindow外部可点击 popupWindow.setFocusable(true); // 获取焦点 // 设置popupwindow的位置(相对tvLeft的位置) //x,y关于原点的偏移量(横坐标,纵坐标) popupWindow.showAsDropDown(llClass, 0, 0); /*设置popupwindow消失的点击事件*/ popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { resetFilterStatus(); } }); } 大家之所以都喜欢用PopupWindow ,最主要的还是因为可以设置动画效果。具体步骤如下。在style样式中增加: <style name="PopupAnimation"> <item name="android:windowEnterAnimation">@anim/fade_in</item> <item name="android:windowExitAnimation">@anim/fade_out</item> </style> res下新建anim文件夹,新建两个xml文件,一个是弹出效果一个是收缩效果。fade_in.xml <?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:pivotY="0%" android:pivotX="0%" android:toYScale="1.0" android:fromYScale="0.5" android:toXScale="1.0" android:fromXScale="1.0" android:duration="200"/> <alpha android:duration="200" android:toAlpha="1.0" android:interpolator="@android:anim/decelerate_interpolator" android:fromAlpha="0.0"/> </set> fade_out.xml <?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:pivotY="0%" android:pivotX="0%" android:toYScale="0.5" android:fromYScale="1.0" android:toXScale="1.0" android:fromXScale="1.0" android:duration="200"/> <alpha android:duration="200" android:toAlpha="0.0" android:interpolator="@android:anim/accelerate_interpolator" android:fromAlpha="1.0"/> </set> 最后调用popupWindow.setAnimationStyle(R.style.PopupAnimation); 5、总结 写了一晚上,有关于PopupWindow 的用法讲完了,可能没有讲的很全面,这只是我个人对于这个控件平时使用的一些心得,如果有需要补充或错误的,欢迎大家留言或者私聊我 。本文属于原创,如有转载,请标注原作者,版权归本公众号所有。如果你喜欢我写的文章请关注程序IT圈 ,欢迎大家继续关注本公众号的技术博文。如果您觉得这篇文章对你有所帮助的话,不妨点个赞或给个赞赏哈,您的支持就是我坚持原创的动力。 推荐阅读福利篇:学习编程视频免费领取 [](http://mp.weixin.qq.com/s?__biz=MzAxMTE3MDkyMA==&mid=2654410864&idx=1&sn=7f383b7cdfb9049ec5a1a87244e2f114&chksm=80869d77b7f1146188195acdd4c56a2e5e00ab1fa20e69af9511c3f8ff49ccc820be936fe953&scene=21#wechat_redirect)Retrofit常见注解全解析 五大步骤快速搭建个人网站

优秀的个人博客,低调大师

用loadrunner代理录制手机APP脚本

利用loadrunner代理方式录制手机(iPhone、android)应用程序HTTP脚本 1.利用笔记本网卡或者类似360随身wifi,在安装loadrunner的电脑上共享网络,在手机上连接共享的wifi。 2.配置手机wifi连接的HTTP代理地址和端口,代理地址(服务器)为电脑的ip地址,端口可以写1-65535,建议使用不常用的端口,如:9898。 3.打开loadrunner脚本编辑器,选择录制协议为HTTP协议,同时设置录制模式为代理,端口填写手机上设置的端口,如图1。图是采用loadrunner12进行设置,loadrunner11同样可以,在录制选项卡里设置监控端口。 4.点击录制,然后在手机上打开需要录制的应用程序,操作需要录制的业务,当需要结束时,点击结束录制。 5.至此,通过loadrunner代理方式就将手机上的应用程序的脚本就录制下来了。 本文转自 昊洋教育 51CTO博客,原文链接:http://blog.51cto.com/zdytesting/1733661,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册