¿Es posible fusionar stickylistviewheader con crisbanes pulltorefresh?
Estoy construyendo una aplicación donde pulltorefresh y stickylistHeaders son need.i han implementado el pulltorefresh en la aplicación, pero no soy capaz de hacerlo funcionar con stickyListHeaders.Is es posible fusionar las dos bibliotecas? ¿O hay alguna alternativa? ¿Ideas?
- Problema mientras se desplaza Vista de lista con Pull to Refresh
- Android Pull para actualizar ListView: eliminar la pista de flecha
- Error: En <declare-styleable> SherlockSpinner, no se puede encontrar el atributo android: popupPromptView
- Tire para actualizar como nueva aplicación gmail (4.5)
- Cómo implementar Android Pull-to-Refresh
- Android implementa SwipeListView con Pull para actualizar
- Utilizar PullToRefreshExpandableListView en Fragmento
- ProgressBar en ActionBar, como la última actualización de la aplicación de GMail
- Galería QuiltView con Pull para actualizar en Android?
- Xamarin Forms ListView Programatic Refresh No se detiene en Android cuando se carga la página
- Deslizar hacia abajo para actualizar el diseño del material
- Android Pull-to-Refresh con Fragmento ListView y Adaptador ListView personalizado
- Cómo implementar pull para actualizar en un ListFragment
Mi implementación se rompió después de actualizar ambas bibliotecas, también. Esta es mi solución rápida para que funcione de nuevo. ¡Cualquier sugerencia y mejora son bienvenidas!
-
Hacer una nueva clase y extender el SticklistListHeadersListView e implementar la interfaz ViewDelegate de ActionBar-PullToRefresh:
public class PtrStickyListHeadersListView extends StickyListHeadersListView implements ViewDelegate { public PtrStickyListHeadersListView(Context context) { super(context); } public PtrStickyListHeadersListView(Context context, AttributeSet attrs) { super(context, attrs); } public PtrStickyListHeadersListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean isReadyForPull(View view, float v, float v2) { View childView = getWrappedList().getChildAt(0); int top = (childView == null) ? 0 : childView.getTop(); return top >= 0; } }
-
Y en su
layout.xml
reemplazar<se.emilsjolander.stickylistheaders.StickyListHeadersListView ...>
con
<com.yourapp.package.foo.PtrStickyListHeadersListView ...>
-
Y por último, agregue el delegado: (
listView
es una instancia de PtrStickyListHeadersListView)ActionBarPullToRefresh.from(getActivity()) // We need to insert the PullToRefreshLayout into the Fragment 's ViewGroup .insertLayoutInto(viewGroup) // We need to mark the ListView and it 's Empty View as pullable // This is because they are not dirent children of the ViewGroup .theseChildrenArePullable(R.id.your_list_id) // We can now complete the setup as desired .listener(...) .useViewDelegate(PtrStickyListHeadersListView.class, listView) .setup(mPullToRefreshLayout);
Similar a la respuesta de Helden, también puedes lograr esto usando una clase interna anónima sin extender StickyListHeadersListView
myList = (StickyListHeadersListView) v.findViewById(R.id.your_list_id); ActionBarPullToRefresh.from(getActivity()) .allChildrenArePullable() .listener(this) .useViewDelegate(StickyListHeadersListView.class, new ViewDelegate() { @Override public boolean isReadyForPull(View view, float v, float v2) { return ... //check if list is scrolled to the top or not } }) .setup(mPullToRefreshLayout);
- Reciclador Ver Agregar Quitar Elemento Animaciones que no se muestran en swapCursor
- Android geolocalización mediante el código de teléfono: 3 error