Una vez que el FastScroller
(en su AbsListView
clase que se extiende desde ListView
) obtiene sus secciones llamando SectionIndexer#getSections()
, nunca volverlos a menos que se obtiene activar/desactivar rápidamente de desplazamiento, como se menciona en el enlace que usted ha mencionado. Para que el valor se muestre en la pantalla, FastScroller llama al método toString de la sección.
Una solución potencial es tener una costumbre SectionIndexer
que tienen las siguientes características:.
- La matriz de secciones es de longitud fija (longitud máxima de la cantidad esperada de secciones Por ejemplo, si las secciones representan Inglés alfabeto será 26)
- tener un objeto personalizado para representar secciones, en lugar de utilizar cadenas
- Sobreescribir el método de la sección de objeto personalizado
toString
para mostrar lo que quiere en función de las corrientes de los valores de la sección. -
e.g. En su aduana SectionIndexer
private int mLastPosition;
public int getPositionForSection(int sectionIndex) {
if (sectionIndex < 0) sectionIndex = 0;
// myCurrentSectionLength is the number of sections you want to have after
// re-indexing the items in your ListView
// NOTE: myCurrentSectionLength must be less than getSections().length
if (sectionIndex >= myCurrentSectionLength) sectionIndex = myCurrentSectionLength - 1;
int position = 0;
// --- your logic to find the position goes in here
// --- e.g. see the AlphabeticIndexer source in Android repo for an example
mLastPosition = position;
return mLastPosition;
}
public Object[] getSections() {
// Assume you only have at most 3 section for this example
return new MySection[]{new MySection(), new MySection(), new MySection()};
}
// inner class within your CustomSectionIndexer
public class MySection {
MySection() {}
public String toString() {
// Get the value to displayed based on mLastPosition and the list item within that position
return "some value";
}
}
que estoy haciendo algo similar AQUÍ http://stackoverflow.com/questions/10224233/alphabetindexer-with-custom-adapter-managed-by-loadermanager – toobsco42