Widget - ScrollBar + OverScroll

//moreblock: |customScrollBar| |view:item| (namber:r) (namber:g) (namber:b)


try {
java.lang.reflect.Field mScrollCacheField = View.class.getDeclaredField("mScrollCache");
mScrollCacheField.setAccessible(true);
Object mScrollCache = mScrollCacheField.get(_item);
java.lang.reflect.Field scrollBarField = mScrollCache.getClass().getDeclaredField("scrollBar");
scrollBarField.setAccessible(true);
Object scrollBar = scrollBarField.get(mScrollCache);
java.lang.Class param = android.graphics.drawable.Drawable.class;

java.lang.reflect.Method method = scrollBar.getClass().getDeclaredMethod("setVerticalThumbDrawable", param);

method.setAccessible(true);
method.invoke(scrollBar, getResources().getDrawable(R.drawable.scroll_res));
}
catch(Exception e)
{
e.printStackTrace();
}

if (Build.VERSION.SDK_INT >= 21) {
android.widget.EdgeEffect edgeEffectTop = new android.widget.EdgeEffect(this);
edgeEffectTop.setColor(Color.rgb((int)_r,(int)_g,(int)_b));
android.widget.EdgeEffect edgeEffectBottom = new android.widget.EdgeEffect(this);
edgeEffectBottom.setColor(Color.rgb((int)_r,(int)_g,(int)_b));

try {
java.lang.reflect.Field f1 = android.widget.ScrollView.class.getDeclaredField("mEdgeGlowTop");
f1.setAccessible(true);
f1.set(_item, edgeEffectTop);

java.lang.reflect.Field f2 = android.widget.ScrollView.class.getDeclaredField("mEdgeGlowBottom");
f2.setAccessible(true);
f2.set(_item, edgeEffectBottom);
}
catch (Exception e)
{
e.printStackTrace();
}
} else {

int glowDrawableId = getResources().getIdentifier("overscroll_glow", "drawable", "android");

android.graphics.drawable.Drawable androidGlow = getResources().getDrawable(glowDrawableId);

androidGlow.setColorFilter(Color.rgb((int)_r,(int)_g,(int)_b), PorterDuff.Mode.MULTIPLY);
int edgeDrawableId = getResources().getIdentifier("overscroll_edge", "drawable", "android");

android.graphics.drawable.Drawable androidEdge = getResources().getDrawable(edgeDrawableId);

androidEdge.setColorFilter(Color.rgb((int)_r,(int)_g,(int)_b), PorterDuff.Mode.MULTIPLY);
}

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to find and​ highlight a word in a text field in Sketchware?

A Flash Light App in Sketchware

How to enable download in webview in Sketchware apps?

Intent - Open File By Type

Code for implementing Notifications in Sketchware

How to share an image from Drawable folder?

ActionBar back button

Animation Transtition Animation