I created a custom scroll view that I use for various reasons. I'm trying to apply a fading edge to it but I can't get it to work; it's working fine on standard scroll views. This is how I use my custom scroll view:
<com.myapp.app.MyCustomScrollView
android:id="@+id/myscustomscrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp">
<LinearLayout...
</LinearLayout>
</com.myapp.app.MyCustomScrollView>
I tried to add fading through the XML like this:
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="5dp"
and it didn't work, so I tried by code:
myscustomscrollview.setHorizontalFadingEdgeEnabled(true);
myscustomscrollview.setFadingEdgeLength(FADING_SIZE);
and it didn't work either.
This is my custom view, I just extended Scrollview and overridden a method
public class MyCustomScrollView extends ScrollView {
public MyCustomScrollView(Context context) {
super(context);
}
public MyCustomScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyCustomScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
//Custom logic
}
}