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] 转载仅供参考,版权属于原作者。祝你愉快,满意请采纳哦

个人网站备案流程及注意事项(内容方向和适用主机商)

如今我们还有在做个人网站吗?随着自媒体和短视频的发展和兴起,包括我们很多WEB2.0产品的延续,当然也包括个人建站市场的低迷和用户关注的不同,有些个人已经不在做网站。但是,由于我们有些朋友出于网站的爱好或者说是有些项目还是基于PC端网站的,还是有网友抱有信心的,比如我们看到有一些老牌个人网站依旧在运行,且还有新网站的出现。今天在这篇文章中谈谈有网友问关于个人网站备案的问题。这个也是前几天有他在选择...

提速啦:美国多IP站群云服务器 8核8G 10M带宽 7IP 88元/月

提速啦(www.tisula.com)是赣州王成璟网络科技有限公司旗下云服务器品牌,目前拥有在籍员工40人左右,社保在籍员工30人+,是正规的国内拥有IDC ICP ISP CDN 云牌照资质商家,2018-2021年连续4年获得CTG机房顶级金牌代理商荣誉 2021年赣州市于都县创业大赛三等奖,2020年于都电子商务示范企业,2021年于都县电子商务融合推广大使。资源优势介绍:Ceranetwo...

SpinServers(月89美元) 2*e5-2630L v2,美国独立服务器

SpinServers服务商也不算是老牌的服务商,商家看介绍是是2018年成立的主机品牌,隶属于Majestic Hosting Solutions LLC旗下。商家主要经营独立服务器租用和Hybrid Dedicated服务器等,目前包含的数据中心在美国达拉斯、圣何塞机房,自有硬件和IP资源等,商家还自定义支持用户IP广播到机房。看到SpinServers推出了美国独服的夏季优惠促销活动,最低月...

declare styleable为你推荐
巴西时区巴西与中国的时差是多少巴西时区巴西和中国的时差是多少 里约和北京时差怎么算高质量图片ps 合成图片,怎样才算高质量的?从那些方面判定照片的质量充值卡充值买完充值卡了,怎么充值微信收费微信提现收费是怎么计算的 从什么时候开始收费移动硬盘提示格式化急!!移动硬盘提示:需要格式化才可以使用 怎么办??3d规则3d中奖规则rar分卷压缩分卷压缩的如何分卷压缩文件delphi2007delphi2007 如何 连接oracle数据库 求详细的过程。外贸信息外贸企业如何查询报关单详细信息:如美元离岸价等?
美国vps推荐 burstnet 新加坡服务器 jsp主机 windows2003iso 怎么测试下载速度 股票老左 中国网通测速 电信虚拟主机 中国电信宽带测速器 万网主机管理 网站加速软件 免费的asp空间 阿里云免费邮箱 如何登陆阿里云邮箱 双十二促销 htaccess cdn加速 hosts文件 国内免备案空间 更多