dworks / astickyheader Goto Github PK
View Code? Open in Web Editor NEWAndroid Sticky Headers : now headers everywhere
Home Page: https://github.com/DWorkS/AStickyHeader
Android Sticky Headers : now headers everywhere
Home Page: https://github.com/DWorkS/AStickyHeader
When using PinnedSectionGridView
, I noticed that removing the android:gravity="center"
attribute will break header functionality, where headers will oddly appear on the last column of the GridView.
This is also happening in the sample project, in activity_grid.xml
.
Granted, I'm developing on API level 15, which is rather old. Not sure if this could be related.
Hi.
I am using your library in my project.
Now, How to i can disable sticky in gridview (allow gridview scroll same as normal, still keep header but no sticky them when scroll on first) ?
Sorry for my English.
Thanks so much.
I am trying to wrap my CursorAdaptor subclass with the SimpleSectionedListAdapter class and it is giving me an issue:
java.lang.IllegalStateException: this should only be called when the cursor is valid
at android.widget.CursorAdapter.getView(CursorAdapter.java:243)
Looking at the code from the SSLA class it seems like it's trying to call the cursor adapter's getView
method. Obviously that won't work for CursorAdapters
Hi
In the example and all the manifest put as min api 8, but in the code explispe caims at least api level 16.
getPaddingRight(),getNumColumns(),getNumColumns(), needs an api over 8....
public void setGridView(GridView gridView){
if(!(gridView instanceof PinnedSectionGridView)){
throw new IllegalArgumentException("Does your grid view extends PinnedSectionGridView?");
}
mGridView = gridView;
mStrechMode = gridView.getStretchMode();
mWidth = gridView.getWidth() - (mGridView.getPaddingLeft() + mGridView.getPaddingRight());
mNumColumns = ((PinnedSectionGridView)gridView).getNumColumns();
requestedColumnWidth = ((PinnedSectionGridView)gridView).getNumColumns();
requestedHorizontalSpacing = ((PinnedSectionGridView)gridView).getHorizontalSpacing();
}
Is there a quick guide on how to use it?
I am using <dev.dworks.libs.astickyheader.ui.PinnedSectionGridView>.
Based on a floating list popup window index click I want to focus ( scroll) to that part of grid view.
I am passing the selection index to go to that section of gridview but nothing seems to happen.
GridView is not scrolling to selected position in grid view.
When selection happens I am saving the current position.
int index = gridview.getFirstVisiblePosition();
And when you come back to the gridview then trying to do
gridview.smoothScrollToPosition(int index)
//gridView.setSelection(position);
int index = gridView.getFirstVisiblePosition();
ListAdapter adapter = gridView.getAdapter();
gridView.smoothScrollToPosition(index + position);
when i do:
mSimpleSectionedGridAdapter.notifyDataSetChanged();
it doesn't work, till i touch the view.so could you help me to find out why it performs that?
i found : setSections(Section... sections) -->Only the original thread that created a view hierarchy can touch its views.so use Handler to update the view .
Using SimpleSectionedGridView, if I add section headers, the position offset is wrong. In section[0] it is 2 higher than it should be, in section[1] 4 and so on. Presumably, each header adds two phantom items to the grid.
Sometimes scrolling is not smooth.
Putting rounded corners as the background:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/MTPDarkGreen" />
<corners android:radius="10dp" />
</shape>
It works except that the enclosing rectangle has a white background, which can't be changed. I'm using a colour background on the grid view so it looks a little odd. Is there a way of changing the background to, say, transparent?
If i set a fixed columnNum then i see no sections. By checking the code it looks like support only for columnNum=AUTO-FIT. I would make the grid more dynamic for different column numbers and no fixed column width.
I have tried,
given a position none of these methods jump to / scroll to respective position on the grid. Please let me know if there are any alternative.
After adding the headerView, when list is scrolled it is raising NPE
How to use that lib inside of ScrollView ? Is there any function for inside of ScrollView ? Thanks..
I think it would be good to change the setSections method in SimpleSectionedAdapter from
public void setSections(Section[] sections)
to
public void setSections(Section... sections)
It would not change the way it used to called, but better for the case only one section been used.
It would be great if this library available on central repository, do you have any plan for this?
How can I change font color and background of textView of header dynamically at run time?
if I set android:numColumns="auto_fit" in PinnedSectionGridView, I have crash.
04-27 10:00:51.673 3408-3408/dev.dworks.libs.astickyheader.sample E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at dev.dworks.libs.astickyheader.ui.PinnedSectionGridView.ensureShadowForPosition(PinnedSectionGridView.java:279)
at dev.dworks.libs.astickyheader.ui.PinnedSectionGridView$1.onScroll(PinnedSectionGridView.java:131)
at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1326)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5055)
at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3193)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3467)
at android.view.View.dispatchTouchEvent(View.java:7127)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905)
at dev.dworks.libs.astickyheader.ui.PinnedSectionGridView.dispatchTouchEvent(PinnedSectionGridView.java:484)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379)
at android.app.Activity.dispatchTouchEvent(Activity.java:2396)
at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:268)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873)
at android.view.View.dispatchPointerEvent(View.java:7307)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3172)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3117)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4224)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4203)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4243)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:523)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
I need different column numder on different device and orientation.
Library does not support "auto_fit"?
load more how to deal
Ideally, I would use:
android:stretchMode="spacingWidthUniform"
in my gridView. However, doing so causes the section header view to behave very strangely. Whilst floating, it starts at some point in the first column of the grid view and extends to the right-hand side, or, if the gravity is changed, it moves to the right or off the left of the screen. Putting fixed gaps makes it work, but doesn't look so good in landscape.
would like to add a checkbox to it
Hi.
As said in issue title, state_pressed rule of background selector doesn't work for pinned list item. How can I fix this strange behavior?
Thanks in advance for any help.
Hi! Can AStickyHeader be adapted to CollectionView? It is a new flexible list/grid control introduced in Google IO 2014 app. It's implemented on top of ListView and seems quite useful. It has it's own headers support but not sticky. There is an extract of CollectionView at https://github.com/felixWackernagel/Android-CollectionView
Please change package name in sample mainfest.xml to *.demo
I have some suggestions and remarks of how to improve the code of the library.
Here are things i've modified to the code and added a link to download:
Here are things I think should be added:
the SimpleSectionedGridAdapter is too hard to customize, especially the header part. it could be nice to be able to have an abstract function called "handleHeaderView" instead of using a layout resource Id and an id of the textview within it.
there is no usage of the ViewHolder design pattern (watch "the world of listView" lecture for more information). this could make a smoother experience.
HeaderLayout isn't really needed. you can change the layout of whatever view that was used there, and update it, for example:
layoutParams = header.getLayoutParams();
layoutParams.width = getHeaderSize();
header.setLayoutParams(layoutParams);
For some reason I can't find out how to upload files here, so I've uploaded to a third party website (google drive). Here is a minimized version of the projects:
https://drive.google.com/file/d/0B_nrUhQ0MIgwdFRaNnNVR3QycDA/edit?usp=sharing
Please let me know what you think about it.
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.