Tak, przedłużyć Scrollview i zastąpić tych metod (na podstawie Donut-Release2):
@Override
protected float getTopFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
return 1.0f;
}
@Override
protected float getBottomFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
return 1.0f;
}
Dla porównania, jest to oryginalny kod, który skraca blaknięcie krawędzi jako zbliżasz się do końca listy:
@Override
protected float getTopFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
final int length = getVerticalFadingEdgeLength();
if (mScrollY < length) {
return mScrollY/(float) length;
}
return 1.0f;
}
@Override
protected float getBottomFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
final int length = getVerticalFadingEdgeLength();
final int bottomEdge = getHeight() - mPaddingBottom;
final int span = getChildAt(0).getBottom() - mScrollY - bottomEdge;
if (span < length) {
return span/(float) length;
}
return 1.0f;
}
Czy możesz powiedzieć, dlaczego chcesz to zrobić? Efekt zanikający został zaprojektowany w celu poinformowania użytkownika, że może przewijać w tym kierunku. Jeśli zmienisz go tak, by zawsze pokazywał blednącą krawędź, użytkownik pomyśli, że może przewinąć w dowolnym kierunku i pomyśleć, że coś jest zepsute, gdy nie jest to możliwe. –