Just a Wheel——A easy way to setEmptyView to ListView、GridView or RecyclerView etc..

Last update: Apr 24, 2022

中文说明在这里

TEmptyView

Android Arsenal

Just a Wheel—— A easier way to setEmptyView. Without having to write xml file every time. It supports AdapterView(ListView,GridView,etc) and RecyclerView.

Dependency

	compile 'com.barryzhang:temptyview:0.0.1'

Usage

I. Initialize

initialize some custom attributes —— this step is not necessary, if you don't do it, it will use the default settings.

TEmptyView.init(TViewUtil.EmptyViewBuilder.getInstance(context)
       .setShowText(true)
       .setEmptyText("NO DATA")
       .setShowButton(false)
       ...
       .setShowIcon(true));

II. Set EmptyView

1.simple

    TViewUtil.setEmptyView(listView)

IMAGE1

2.custom

The view of TEmptyView is made of 3 parts: ImageView、TextView、Button. You can custom each of it.

TViewUtil.EmptyViewBuilder.getInstance(this)
	.setEmptyText("Nothing here~")
	.setEmptyTextSize(12)
	.setEmptyTextColor(Color.GRAY)
	.setIconDrawable(drawableAirplan)
	.setShowButton(true)
	.setActionText("Click")
	.setAction(new View.OnClickListener() {
		@Override
		public void onClick(View view) {
		    Toast.makeText(getApplicationContext(),
		            "Yes, clicked~",Toast.LENGTH_SHORT).show();
		}
	})
	.bindListView(listView);

IMAGE2

Other

1.RecyclerView

Usage of RecyclerView is the same as AdapterView, but you must call setAdapter first.

	recyclerView.setAdapter(adapter);
	TViewUtil.EmptyViewBuilder.getInstance(getContext())
           .setEmptyText("This is a empty view in RecyclerView")
           ...
           .bindListView(recyclerView);

2.Tips

If you din't call TEmptyView.init(..) in Application's onCreate method(This is recommend but not necessary), It is better to use Application as context instead of Activity, otherwise may easily cause memory leak.

Please excuse my poor English :)

License License

Copyright 2016 Barry Zhang

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

GitHub

https://github.com/barryhappy/TEmptyView
You might also like...

Easily create complex recyclerview adapters in android

Easily create complex recyclerview adapters in android

😔 Due to the nature of my job and growing popularity of Jetpack Compose, I lack the motivation to keep this project alive. Recyclerview is one of the

Aug 1, 2022

Drag and drop to reorder items in a list, grid or board for Android. Based on RecyclerView. Also supports swiping items in a list.

Drag and drop to reorder items in a list, grid or board for Android. Based on RecyclerView. Also supports swiping items in a list.

DragListView DragListView can be used when you want to be able to re-order items in a list, grid or a board. It also supports horizontal swiping of it

Aug 9, 2022

This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS --

This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->

PlaceHolderView An advance view for lists and stacks Some Implementations Documentation You can find the PlaceHolderView documentation here which has

Aug 2, 2022

A simple launcher which displays all the apps on a RecyclerView trying to KISS

A simple launcher which displays all the apps on a RecyclerView trying to KISS

Jun 17, 2022

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Aug 10, 2022

[] A simple way to "badge" any given Android view at runtime without having to cater for it in layout

[] A simple way to

Android ViewBadger A simple way to "badge" any given Android view at runtime without having to cater for it in layout. Note: If your aim is to replica

Aug 18, 2022

An elegant way to show your menu or messages.

An elegant way to show your menu or messages.

Android View Hover In my opinion, jumping to a new activity to show your menu is a kind of wasting time and life. So, I think, we need a hover view, t

Aug 12, 2022

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Aug 6, 2022

SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack for Android Activities to do pretty the same as the android

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

May 11, 2022
Comments
  • 1. Icon not showing

    I've tried a bunch of different icons including the preset ones and still it shows only text !?

        TViewUtil.EmptyViewBuilder.getInstance(this)
            .setEmptyText(R.string.emptylist)
            .setEmptyTextSize(18)
            .setEmptyTextColor(Color.GRAY)
            .setIconSrc(R.drawable.box)
            .bindView(recyclerView);
      }
    

    my activity xml

    <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/bg">
    
      <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:padding="5dp"
        android:layout_below="@id/toolbar"
        android:layout_above="@id/ad_bar"
        android:scrollbars="vertical"/>
    
    </RelativeLayout>
    
    Reviewed by AlaaZarifa at 2017-08-01 05:57
  • 2. 也许可以试着支持一下ConstraintLayout了

    我沿用了你的思路,但如果给emptyView设置了ConstraintLayout.LayoutParams之后,在使用ConstraintLayout.removeView(emptyView)时,会有一个问题,emptyView消失,但RecyclerView的内容没有立即显示,需要手动拖动下才会显示出来。但如果你不给emptyView设置Constraint.LayoutParams则没有问题。

    Reviewed by negier at 2021-06-08 04:04
Related tags
Custom wheel widget for android
Custom wheel widget for android

Wheel widget for Android To include the wheel widget in the current layout, you should add in the layout xml this lines: <it.sephiroth.android

Mar 11, 2022
Simple and fantastic wheel view in realistic effect for android.
Simple and fantastic wheel view in realistic effect for android.

Overview ![Size](https://img.shields.io/badge/Size-17 KB-e91e63.svg) Contact Preview Demo WheelPicke.APK Include Compile compile 'cn.aigestudio.wheelp

Aug 10, 2022
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Jul 22, 2022
Android ListView with drag and drop reordering.

DragSortListView NOTICE: No longer maintained. I do not have much time to devote to this project so I am dropping support for the time being. Sorry ev

Aug 8, 2022
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Aug 17, 2022
Android Material Json Form Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular format.
Android Material Json Form Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular format.

Android Json Wizard Android Json Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular f

Apr 26, 2022
Step by step,just use HorizontalStepView,VerticalStepView. step indicator,flow indicator,timeline,order process,express status
Step by step,just use HorizontalStepView,VerticalStepView. step indicator,flow indicator,timeline,order process,express status

StepView Step by step. Step indicator. Flow indicator。 snapshot like this:HorizontalStepView like this also like this:VerticalStepView Yeah,I am not w

Aug 18, 2022
Android Library that lights items for tutorials or walk-throughs etc...
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

Aug 8, 2022
Android library for multiple snapping of RecyclerView
Android library for multiple snapping of RecyclerView

MultiSnapRecyclerView Gradle dependencies { implementation 'com.github.takusemba:multisnaprecyclerview:x.x.x' } Features This is an Android Libra

Aug 18, 2022
This project has been superseded by SuperSLiM, a layout manager for RecyclerView. I strongly recommend using SuperSLiM and not StickyGridHeaders.
This project has been superseded by SuperSLiM, a layout manager for RecyclerView. I strongly recommend using SuperSLiM and not StickyGridHeaders.

StickyGridHeaders Replacement project at SuperSLiM This repository is abandoned and will no longer see any development or support. The replacement Sup

Aug 8, 2022