alamkanak / android-empty-layout Goto Github PK
View Code? Open in Web Editor NEWA library for showing different types of layouts when a list view is empty
License: Apache License 2.0
A library for showing different types of layouts when a list view is empty
License: Apache License 2.0
SwipeRefreshLayout (from support v4 19.1) can has only 1 child.
Currently my solution is to check if the parent is that, and then get its parent (should also check if he has parent, but in my code it always has a parent):
ViewGroup parent = (ViewGroup) mListView.getParent();
// Start editing
if (parent instanceof SwipeRefreshLayout) {
parent = (ViewGroup) parent.getParent();
}
// End editing
this issue is to test if i get an sms
when i using the EmptyLayout in a ListFragment and calling the showLoading() method, no animation appear just the Arrow icon and the loading text.
Could you please fix it?
hello, I found a problem while learning your code. see the usage below:
then, you add "Empty View" into the parent of mListView
(see EmptyLayout.java:463)
You view looks like this:
Obviously, I want the picture in center of list view instead of its parent.
Now I make a little change at EmptyLayout.java:changeEmptyType()
, you can easily understand.
~~~
// insert views in the root view
if (!mViewsAdded) {
RelativeLayout.LayoutParams lp = new LayoutParams(mListView.getWidth(), mListView.getHeight());
lp.topMargin = mListView.getTop();
lp.leftMargin = mListView.getLeft();
RelativeLayout rl = new RelativeLayout(mContext);
rl.setLayoutParams(lp);
if (mEmptyView!=null) {
rl.addView(mEmptyView);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mEmptyView.getLayoutParams();
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
mEmptyView.setLayoutParams(layoutParams);
}
if (mLoadingView!=null) {
rl.addView(mLoadingView);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mLoadingView.getLayoutParams();
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
mLoadingView.setLayoutParams(layoutParams);
}
if (mErrorView!=null) {
rl.addView(mErrorView);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mErrorView.getLayoutParams();
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
mErrorView.setLayoutParams(layoutParams);
}
mViewsAdded = true;
ViewGroup parent = (ViewGroup) mListView.getParent();
parent.addView(rl);
mListView.setEmptyView(rl);
}
~~~
Thanks for your good code.
mEmptyLayout.setEmptyMessage(emptyMessage);
mEmptyLayout.setShowEmptyButton(showEmptyButton);
mEmptyLayout.setEmptyButtonClickListener(listener);
mEmptyLayout.showEmpty();
That is my code, when showEmptyButton is true.
The problem is that the empty button isn't shown
Hi Alam,
First of all thanks for the awesome library.Can u please make it compatible with the recycleview if possible.It would be great to use it with recycleview.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.