{"id":13642381,"url":"https://github.com/barryhappy/TEmptyView","last_synced_at":"2025-04-20T16:32:06.786Z","repository":{"id":57717667,"uuid":"60418122","full_name":"barryhappy/TEmptyView","owner":"barryhappy","description":" Just a Wheel——A easy way to setEmptyView to ListView、GridView or RecyclerView etc..","archived":false,"fork":false,"pushed_at":"2016-07-12T16:39:03.000Z","size":192,"stargazers_count":451,"open_issues_count":5,"forks_count":63,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-08-02T01:15:41.861Z","etag":null,"topics":[],"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/barryhappy.png","metadata":{"files":{"readme":"README.cn.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":"2016-06-04T15:55:42.000Z","updated_at":"2024-01-04T16:05:15.000Z","dependencies_parsed_at":"2022-09-10T22:01:39.006Z","dependency_job_id":null,"html_url":"https://github.com/barryhappy/TEmptyView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryhappy%2FTEmptyView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryhappy%2FTEmptyView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryhappy%2FTEmptyView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryhappy%2FTEmptyView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barryhappy","download_url":"https://codeload.github.com/barryhappy/TEmptyView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223833008,"owners_count":17210761,"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":[],"created_at":"2024-08-02T01:01:30.696Z","updated_at":"2024-11-09T13:31:37.397Z","avatar_url":"https://github.com/barryhappy.png","language":"Java","funding_links":[],"categories":["空白页","Java"],"sub_categories":[],"readme":"\n[English README is HERE](./README.md)\n\n# TEmptyView\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-TEmptyView-green.svg?style=true)](https://android-arsenal.com/details/1/3886)\n\nTEmptyView是一个小轮子，希望能够更简单地设置EmptyView，免除每次设置emptyView都要写xml之苦。\n支持AdapterView(ListView/GridView等)、RecyclerView。\n\n## 导入 \n```groovy\n\tcompile 'com.barryzhang:temptyview:0.0.1' \n```\n\n## 使用 \n\n### 一：初始化： \n\n设置一些自定义的默认属性——这一步并不是必须的，如果没有进行初始化，下一步设置的时候会使用自带的默认属性。\n\n```java\nTEmptyView.init(TViewUtil.EmptyViewBuilder.getInstance(context)\n       .setShowText(true)\n       .setEmptyText(\"NO DATA\")\n       .setShowButton(false)\n       ...\n       .setShowIcon(true));\n```\n\n### 二：设置emptyView\n\n#### 1.极简 \n```java\n    TViewUtil.setEmptyView(listView)\n```\n![IMAGE1](./etc/demo1.png)\n#### 2.高级自定义\nTEmptyView的可视控件由三部分组成：ImageView、TextView、Button，可以对每个部分进行自定义  \n\n```java\nTViewUtil.EmptyViewBuilder.getInstance(this)\n\t.setEmptyText(\"Nothing here~\")\n\t.setEmptyTextSize(12)\n\t.setEmptyTextColor(Color.GRAY)\n\t.setIconDrawable(drawableAirplan)\n\t.setShowButton(true)\n\t.setActionText(\"Click\")\n\t.setAction(new View.OnClickListener() {\n\t\t@Override\n\t\tpublic void onClick(View view) {\n\t\t    Toast.makeText(getApplicationContext(),\n\t\t            \"Yes, clicked~\",Toast.LENGTH_SHORT).show();\n\t\t}\n\t})\t\n\t.bindListView(listView);\n```\n\n![IMAGE2](./etc/demo2.png)\n## 注意事项\n\n#### 1.RecyclerView\n用法基本AdapterView一样，但是需要先设置adapter。 \n\n```\n\trecyclerView.setAdapter(adapter);\n\tTViewUtil.EmptyViewBuilder.getInstance(getContext())\n           .setEmptyText(\"This is a empty view in RecyclerView\")\n           ...\n           .bindListView(recyclerView);\n```\n\n#### 2.小提示：\n初始化(TEmptyView.init)的时机——建议放到Application的onCreate方法中，不过实际上只需要保证在第一次设置emptyView前进行初始化即可。如果在其他地方初始化，记得传入的context值最好`不要使用Activity`，否则有可能会引起内存泄漏。\n\n\n\n*仍在开发中……以上所有内容都随时可能会变 (笑)*  \n\n\n许可 ![License](https://img.shields.io/hexpm/l/plug.svg)\n-----------------------------------------------------\n\n[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarryhappy%2FTEmptyView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarryhappy%2FTEmptyView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarryhappy%2FTEmptyView/lists"}