I have an Android scrollview with a white background. The fading edge is a white translucent gradient. I would like to change it be black instead of white. I have a ListView in the same project with a white background that has a black fading edge by default, but I can't find where (if anywhere) that was set.
I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?
Just found it out by trial and error.
ReplyDeleteSimply set android:background="@color/yourColor" for the <ScrollView>. It will set the shadow to the given colour.
If you want a different color fading edge than the background, you have to override the ScrollView's getSolidColor() method. For example:
ReplyDelete@Override
public int getSolidColor() {
return Color.rgb(0x30, 0x30, 0x30);
}
Fading edge color is controlled by the android:cacheColorHint attribute.
ReplyDeleteE.g.:
<ScrollView android:cacheColorHint="#ff000000" android:background="#ffffffff" />
will set the background to white, and the cacheColorHint is used to draw the fading edge color -- in this case, it would be black.
If you don't know what changed the color of your fading edge, it was probably the application of a style or theme. Check your manifest for android:theme="something" in an Activity. If the theme is from the group android.R.style.Theme.Light the edge will be white. The default android.R.style.Theme and android.R.style.Theme.Black will have black fading edges. Themes also affect other attributes, so check out the attributes fully before you throw them in for one thing.
ReplyDelete