declare styleable如何减慢slidingdrawer的动画速度

declare styleable  时间:2022-02-27  阅读:()

如何减慢slidingdrawer的动画速度

我是这样做的,把代码贴出来看看对你有没有用! styleable.xml [mw_shl_code=html,true]<?xml version="1.0" encoding="utf-8"?> <resources > <declare-styleable name="SlidingDrawer"> <attr name="orientation"> <enum name="horizontal" value="0" /> <enum name="vertical" value="1" /> </attr> <attr name="bottomOffset" format="dimension|reference"/> <attr name=&Offset" format="dimension|reference"/> <attr name="allowSingleTap" format="boolean"/> <attr name="animateOnClick" format="boolean"/> <attr name="handle" format="reference"/> <attr name="content" format="reference"/> </declare-styleable> </resources> [/mw_shl_code] MySlidingDrawer.java [mw_shl_code=java,true] public MySlidingDrawer(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SlidingDrawer, 0, 0); int orientation = a.getInt(R.styleable.SlidingDrawer_orientation, ORIENTATION_VERTICAL); mVertical = orientation == ORIENTATION_VERTICAL; mBottomOffset = (int) a.getDimension(R.styleable.SlidingDrawer_bottomOffset, 0.0f); mTopOffset = (int) a.getDimension(R.styleableOffset, 0.0f); mAllowSingleTap = a.getBoolean(R.styleable.SlidingDrawer_allowSingleTap, true); mAnimateOnClick = a.getBoolean(R.styleable.SlidingDrawer_animateOnClick, true); int handleId = a.getResourceId(R.styleable.SlidingDrawer_handle, 0); if (handleId == 0) { throw new IllegalArgumentException("The handle attribute is required and must refer " + "to a valid child."); } int contentId = a.getResourceId(R.styleable.SlidingDrawer_content, 0); if (contentId == 0) { throw new IllegalArgumentException("The content attribute is required and must refer " + "to a valid child."); } if (handleId == contentId) { throw new IllegalArgumentException("The content and handle attributes must refer " + "to different children."); } mHandleId = handleId; mContentId = contentId; final float density = getResources().getDisplayMetrics().density; mTapThreshold = (int) (TAP_THRESHOLD * density + 0.5f); mMaximumTapVelocity = (int) (MAXIMUM_TAP_VELOCITY * density + 0.5f); mMaximumMinorVelocity = (int) (MAXIMUM_MINOR_VELOCITY * density + 0.5f); mMaximumMajorVelocity = (int) (MAXIMUM_MAJOR_VELOCITY * density + 0.5f); eleration = (int) (MAXIMUM_ACCELERATION * density + 0.5f); mVelocityUnits = (int) (VELOCITY_UNITS * density + 0.5f); a.recycle(); setAlwaysDrawnWithCacheEnabled(false); }[/mw_shl_code] 转载仅供参考,版权属于原作者。祝你愉快,满意请采纳哦

腾讯云爆款秒杀:1C2G5M服务器38元/年,CDN流量包6元起

农历春节将至,腾讯云开启了热门爆款云产品首单特惠秒杀活动,上海/北京/广州1核2G云服务器首年仅38元起,上架了新的首单优惠活动,每天三场秒杀,长期有效,其中轻量应用服务器2G内存5M带宽仅需年费38元起,其他产品比如CDN流量包、短信包、MySQL、直播流量包、标准存储等等产品也参与活动,腾讯云官网已注册且完成实名认证的国内站用户均可参与。活动页面:https://cloud.tencent.c...

PacificRack(年付低至19美元),夏季促销PR-M系列和多IP站群VPS主机

这几天有几个网友询问到是否有Windows VPS主机便宜的VPS主机商。原本他们是在Linode、Vultr主机商挂载DD安装Windows系统的,有的商家支持自定义WIN镜像,但是这些操作起来特别效率低下,每次安装一个Windows系统需要一两个小时,所以如果能找到比较合适的自带Windows系统的服务器那最好不过。这不看到PacificRack商家有提供夏季促销活动,其中包括年付便宜套餐的P...

Hosteons:新上1Gbps带宽KVM主机$21/年起,AMD Ryzen CPU+NVMe高性能主机$24/年起_韩国便宜服务器

我们在去年12月分享过Hosteons新上AMD Ryzen9 3900X CPU及DDR4内存、NVMe硬盘的高性能VPS产品的消息,目前商家再次发布了产品更新信息,暂停新开100M带宽KVM套餐,新订单转而升级为新的Budget KVM VPS(SSD)系列,带宽为1Gbps端口,且配置大幅升级,目前100M带宽仅保留OpenVZ架构产品可新订购,所有原有主机不变,用户一直续费一直可用。Bud...

declare styleable为你推荐
waspWASP的早期WASP微指数新浪微博微指数主要包括哪些内容?战棋类推荐几个好玩的战棋类的游戏cs躲猫猫CS GO怎么玩躲猫猫运行时错误1004ipad下载时出现错误1004是怎么回事?该怎么解决?爬虫网如何自己写一个网络爬虫wizardryHogwarts for pikeys是什么意思???系统登录界面怎么样将系统登陆界面设置为可以切换到窗口登陆?微店是什么开微店和开淘宝店有什么区别吗邮件服务器软件Windows邮件服务器软件那个好
日本私人vps 美国vps 阿里云os 免费ftp空间申请 java空间 灵动鬼影 有益网络 电子邮件服务器 刀片服务器是什么 太原网通测速平台 登陆空间 美国盐湖城 iki 114dns 如何登陆阿里云邮箱 江苏徐州移动 阿里云邮箱个人版 谷歌搜索打不开 美国主机侦探 websitepanel 更多