{"id":13645111,"url":"https://github.com/RmondJone/LockTableView","last_synced_at":"2025-04-21T13:31:47.221Z","repository":{"id":46104820,"uuid":"86885561","full_name":"RmondJone/LockTableView","owner":"RmondJone","description":"Android自定义表格，支持锁双向表头，自适应列宽，自适应行高,快速集成。Android custom table, support two-way lock header, adaptive column width, adaptive line width, rapid integration.","archived":false,"fork":false,"pushed_at":"2019-08-16T00:44:34.000Z","size":6084,"stargazers_count":588,"open_issues_count":11,"forks_count":132,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-09T18:41:38.811Z","etag":null,"topics":["android","excel","table"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RmondJone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-01T05:09:44.000Z","updated_at":"2024-10-31T03:05:55.000Z","dependencies_parsed_at":"2022-09-21T17:50:36.478Z","dependency_job_id":null,"html_url":"https://github.com/RmondJone/LockTableView","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RmondJone%2FLockTableView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RmondJone%2FLockTableView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RmondJone%2FLockTableView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RmondJone%2FLockTableView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RmondJone","download_url":"https://codeload.github.com/RmondJone/LockTableView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250064685,"owners_count":21368948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","excel","table"],"created_at":"2024-08-02T01:02:27.498Z","updated_at":"2025-04-21T13:31:46.449Z","avatar_url":"https://github.com/RmondJone.png","language":"Java","readme":"# LockTableView\n自定义表格,可锁定双向表头,自适应列宽,自适应行高,下拉刷新,上拉加载,快速集成\u003cbr\u003e\n## 效果展示\n\n![image](https://github.com/RmondJone/LockTableView/blob/master/show.gif)\n\n## 工程集成说明\n* 第一步\n```java\n//在工程gradle文件里\nallprojects {\n    repositories {\n        .......\n        maven { url 'https://jitpack.io' }\n        ......\n    }\n}\n```\n\n```java\n//如果不在工程gradle文件里加入，也可以加入模块gradle文件中\nrepositories {\n    maven {\n        url  \"https://jitpack.io\"\n    }\n}\n```\n\n* 第二步\n```java\ndependencies {\n\tcompile 'com.github.RmondJone:LockTableView:1.1.2'\n}\n```\n\n## API使用说明\n\n```java\n\nfinal LockTableView mLockTableView = new LockTableView(this, mContentView, mTableDatas);\nLog.e(\"表格加载开始\", \"当前线程：\" + Thread.currentThread());\nmLockTableView.setLockFristColumn(true) //是否锁定第一列\n      .setLockFristRow(true) //是否锁定第一行\n      .setMaxColumnWidth(100) //列最大宽度\n      .setMinColumnWidth(60) //列最小宽度\n      .setColumnWidth(1,60) //设置指定列文本宽度(从0开始计算,宽度单位dp)\n      .setMinRowHeight(20)//行最小高度\n      .setMaxRowHeight(60)//行最大高度\n      .setTextViewSize(16) //单元格字体大小\n      .setCellPadding(15)//设置单元格内边距(dp)\n      .setFristRowBackGroudColor(R.color.table_head)//表头背景色\n      .setTableHeadTextColor(R.color.beijin)//表头字体颜色\n      .setTableContentTextColor(R.color.border_color)//单元格字体颜色\n      .setNullableString(\"N/A\") //空值替换值\n      .setTableViewListener(new LockTableView.OnTableViewListener() {\n          //设置横向滚动监听\n          @Override\n          public void onTableViewScrollChange(int x, int y) {\n              Log.e(\"滚动值\",\"[\"+x+\"]\"+\"[\"+y+\"]\");\n          }\n      })\n      .setTableViewRangeListener(new LockTableView.OnTableViewRangeListener() {\n                    //设置横向滚动边界监听\n                    @Override\n                    public void onLeft(HorizontalScrollView view) {\n                        Log.e(\"滚动边界\",\"滚动到最左边\");\n                    }\n\n                    @Override\n                    public void onRight(HorizontalScrollView view) {\n                        Log.e(\"滚动边界\",\"滚动到最右边\");\n                    }\n                })\n      .setOnLoadingListener(new LockTableView.OnLoadingListener() {\n          //下拉刷新、上拉加载监听\n          @Override\n          public void onRefresh(final XRecyclerView mXRecyclerView, final ArrayList\u003cArrayList\u003cString\u003e\u003e mTableDatas) {\n              Log.e(\"表格主视图\",mXRecyclerView);\n              Log.e(\"表格所有数据\",mTableDatas);\n              //如需更新表格数据调用,部分刷新不会全部重绘\n              mLockTableView.setTableDatas(mTableDatas);\n              //停止刷新\n              mXRecyclerView.refreshComplete();\n          }\n\n          @Override\n          public void onLoadMore(final XRecyclerView mXRecyclerView, final ArrayList\u003cArrayList\u003cString\u003e\u003e mTableDatas) {\n              Log.e(\"表格主视图\",mXRecyclerView);\n              Log.e(\"表格所有数据\",mTableDatas);\n              //如需更新表格数据调用,部分刷新不会全部重绘\n              mLockTableView.setTableDatas(mTableDatas);\n              //停止刷新\n              mXRecyclerView.loadMoreComplete();\n              //如果没有更多数据调用\n              mXRecyclerView.setNoMore(true);\n          }\n      })\n      .setOnItemClickListenter(new LockTableView.OnItemClickListenter() {\n          @Override\n          public void onItemClick(View item, int position) {\n              Log.e(\"点击事件\",position+\"\");\n          }\n      })\n      .setOnItemLongClickListenter(new LockTableView.OnItemLongClickListenter() {\n          @Override\n          public void onItemLongClick(View item, int position) {\n             Log.e(\"长按事件\",position+\"\");\n          }\n      })\n      .setOnItemSeletor(R.color.dashline_color)//设置Item被选中颜色\n      .show(); //显示表格,此方法必须调用\nmLockTableView.getTableScrollView().setPullRefreshEnabled(true);\nmLockTableView.getTableScrollView().setLoadingMoreEnabled(true);\nmLockTableView.getTableScrollView().setRefreshProgressStyle(ProgressStyle.SquareSpin);\n//属性值获取\nLog.e(\"每列最大宽度(dp)\", mLockTableView.getColumnMaxWidths().toString());\nLog.e(\"每行最大高度(dp)\", mLockTableView.getRowMaxHeights().toString());\nLog.e(\"表格所有的滚动视图\", mLockTableView.getScrollViews().toString());\nLog.e(\"表格头部固定视图(锁列)\", mLockTableView.getLockHeadView().toString());\nLog.e(\"表格头部固定视图(不锁列)\", mLockTableView.getUnLockHeadView().toString());\n\n/**\n * 构造方法\n *\n * @param mContext     上下文\n * @param mContentView 表格父视图\n * @param mTableDatas  表格数据\n */\npublic LockTableView(Context mContext, ViewGroup mContentView, ArrayList\u003cArrayList\u003cString\u003e\u003e mTableDatas) {\n    this.mContext = mContext;\n    this.mContentView = mContentView;\n    this.mTableDatas = mTableDatas;\n    initAttrs();\n}\n\n```\n## 目前支持可自定义属性\n\n```java\n/**\n * 是否锁定首行\n */\nprivate boolean isLockFristRow = true;\n/**\n * 是否锁定首列\n */\nprivate boolean isLockFristColumn = true;\n/**\n * 最大列宽(dp)\n */\nprivate int maxColumnWidth;\n/**\n * 最小列宽(dp)\n */\nprivate int minColumnWidth;\n/**\n * 最大行高(dp)\n */\nprivate int maxRowHeight;\n/**\n  * 最小行高dp)\n  */\nprivate int minRowHeight;\n/**\n * 第一行背景颜色\n */\nprivate int mFristRowBackGroudColor;\n/**\n * 数据为空时的缺省值\n */\nprivate String mNullableString;\n/**\n * 单元格字体大小\n */\nprivate int mTextViewSize;\n/**\n * 表格头部字体颜色\n */\nprivate int mTableHeadTextColor;\n/**\n * 表格内容字体颜色\n */\nprivate int mTableContentTextColor;\n/**\n * 表格横向滚动监听事件\n */\nprivate OnTableViewListener mTableViewListener;\n/**\n * 表格横向滚动到边界监听事件\n */\nprivate OnTableViewRangeListener mTableViewRangeListener;\n/**\n * 表格上拉刷新、下拉加载监听事件\n */\nprivate OnLoadingListener mOnLoadingListener;\n/**\n * Item点击事件\n */\nprivate OnItemClickListenter mOnItemClickListenter;\n/**\n * Item长按事件\n */\nprivate OnItemLongClickListenter mOnItemLongClickListenter;\n/**\n * Item选中颜色\n */\nprivate int mOnItemSeletor;\n/**\n * 单元格内边距\n */\nprivate int mCellPadding;\n\n\n```\n\n## 问题反馈\n* 技术交流群：QQ(264587303)\n* Demo作者：郭翰林\n* 注：有定制化需求自己下源码根据自己的需求改动，不要指望别人给你实现，这样永远没有成长！\n* 本控件实现没有难度，只要静心看代码都能看的懂。我只提供最基础的功能，尽量满足大部分的开发需求。\n* 此项目由于个人原因，已停止维护！望大家见谅！希望有更多热心人士可以Fork此项目进行改造升级！\n\n## License\n```java\nCopyright (c) 2018 Guohanlin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":[],"categories":["表格(Table)"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRmondJone%2FLockTableView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRmondJone%2FLockTableView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRmondJone%2FLockTableView/lists"}