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

茂名网站建设培训linux网页制作软件

茂名网站建设培训,linux网页制作软件,广州南沙区建设局网站,网站建设制作费用预算表首先来看一下效果#xff1a;大体思路如下#xff1a;总体布局用了一个自定义的ViewGroup#xff0c;里面包了两个View(top View#xff0c;bottomView)我在bottomView里放了ViewPager#xff0c;里面又有Fragment#xff0c;Fragment里放的是ListView原理#xff1a;Vi…首先来看一下效果大体思路如下总体布局用了一个自定义的ViewGroup里面包了两个View(top ViewbottomView)我在bottomView里放了ViewPager里面又有FragmentFragment里放的是ListView原理ViewGroup在分发touchEvent的时候先通过手势GestureDetector判断手势方向当向上滑动的时候让topView和bottomView同时向上移动反之亦然。整体思路不是很难如下是干货布局文件android:idid/view_groupandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:idid/group_toplayoutlayout/view_top /android:idid/group_bottomlayoutlayout/view_bottom /手势监听重要的是打log看一下上下滑动是数值的变化找到其规律Overridepublic boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {Log.i(tag, onScroll - distanceY distanceY);if (distanceY 0) {// 手势向下滑动是负值animatorLayoutOffset(1);}if (distanceY 0) {animatorLayoutOffset(0f);}return true;}一定记得在ViewGroup内查找控件需要在onFinishInflate后才能找到Overrideprotected void onFinishInflate() {super.onFinishInflate();viewTop findViewById(R.id.group_top);viewBottom findViewById(R.id.group_bottom);}在ViewGroup布局的逻辑中需要处理的有一下几点1、onMeasure的时候要把子控件测量出来2、onLayout时需要手动将子控件布局接下来就是监听手势设置动画不停的onLayout以达到topView和bottomView的布局效果Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {int width MeasureSpec.getSize(widthMeasureSpec);int height MeasureSpec.getSize(heightMeasureSpec);viewTop.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));viewBottom.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));setMeasuredDimension(width, height);}Overrideprotected void onLayout(boolean changed, int l, int t, int r, int b) {int topHeight viewTop.getMeasuredHeight();float offset layoutOffset * topHeight;int width r - l;float topViewYTop offset - topHeight;float topViewYBottom topViewYTop topHeight;viewTop.layout(0, (int) topViewYTop, width, (int) topViewYBottom);viewBottom.layout(0, (int) topViewYBottom, width, (int) topViewYBottom viewBottom.getMeasuredHeight());}private void animatorLayoutOffset(float offset) {if (animator ! null animator.isRunning()) {return;}animator ObjectAnimator.ofFloat(this, layoutOffset, layoutOffset, offset);animator.setDuration(500);animator.start();}项目地址在这总结以上所述是小编给大家介绍的Android 根据手势顶部View自动展示与隐藏效果希望对大家有所帮助如果大家有任何疑问请给我留言小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持
http://www.pierceye.com/news/992541/

相关文章:

  • 龙岗网站建设 信科网络网站备案后要做什么
  • 深圳建立网站公司网站公众号开发一般收费
  • 网站建设要做什么有关网站建设的书
  • 网站前台开发由什么做的seo网络贸易网站推广
  • 网站设计与开发范本wordpress 左图右文
  • 网站后台的搭建seo网站推广教程
  • 长春做网站的公司男生怎么找的小资源
  • 在线课程网站建设规范甘肃手机版建站系统信息
  • 自定义网站模板中国进出口企业名录
  • 晟合建设集团网站高中文凭能学做网站吗
  • 黑色网站模板建筑工程查询网
  • 建设网站jw100有哪些做鞋机设备的网站
  • 模仿网站建设大学生网站设计论文范文
  • 浙江杭州网站建设服务公司哪家好社区推广经验做法
  • 牟平网站制作公司天安云谷网站建设
  • 培训网站建设方案书沈阳定制网站方案
  • 廊坊公司快速建站电子商务网站建设前期规划方案
  • 西安网站建设盈科wordpress 评论模板
  • 网站制作的电话潍坊建立企业网站公司
  • 二级建造师证书查询官方网站21年没封直接可以进的
  • 计科专业毕设做网站傻瓜式做网站程序
  • 创办网站需要怎么做网站的建设方法包括
  • 直邮网站的推广活动怎么做电商美工是做什么的
  • 唐山建设局网站俄罗斯ip地址
  • 贵州省建设厅网站首页旅游seo
  • 郑州网站建设三猫网络新主题 老版本 wordpress
  • 网站 ftp网站首页布局有哪些
  • 3d模型代做网站微分销商城
  • 县区网站建设运行汇报宝塔 wordpress优化
  • 手机网站判断跳转代码怎么写pc网站怎么做自适应