Android有趣的RecyclerView与海绵宝宝自定义控件

来源:互联网 发布:网络大学考试 编辑:程序博客网 时间:2024/04/28 21:44

今天看一个很有意思的自定义控件给大家分享下,下面直接上干货。
介绍:
有趣的RecyclerView与海绵宝宝字符,海绵宝宝移动他的手和眼睛为ScrollBar的Android。
你可以使用这个列表为孩子应用程序或游戏…你知道。

sdk的最低版本 minSdkVersion=11

Library 大小~ 220 Kb. 是不是很激动
这里写图片描述

这里写代码片需求SDK build-tools 24,从SDK Manager下载。下载将此行添加到build.gradle依赖关系{        compile'c​​om.github.anastr:spongeboblistview:1.0.0'}}为maven<dependency>  <groupId> com.github.anastr </ groupId>  <artifactId> spongeboblistview </ artifactId>  <version> 1.0.0 </ version>  <type> pom </ type></ dependency>用法添加Speedometer到您的Layout.xml。<com.github.anastr.spongeboblistview.SpongebobList        androidid =“@ + id / spongebob_listandroidlayout_width =“match_parent”        androidlayout_height =“match_parent”/>使用getRecyclerView()获取RecyclerView,并添加适配器:SpongebobList spongeList =(SpongebobList)findViewById(R.id.spongebob_list);spongeList.getRecyclerView()。setHasFixedSize(true);LinearLayoutManager llm = new LinearLayoutManager(this);spongeList.getRecyclerView()。setLayoutManager(llm);spongeList.getRecyclerView()。setAdapter(yourAdapter);属性:名称功能spongebob_width海绵宝宝字符的宽度hand_width海绵的手的宽度scroll_line_width滚动条的宽度scroll_line_color滚动条的颜色

好了以上就是关于这开源控件的介绍。

喜欢的可以关注微信公众号,哪里每天都会推荐一篇开源项目Git项目地址在里欢迎订阅
这里写图片描述

0 3