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.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
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 groupandroid.R.style.Theme.Light
the edge will be white. The defaultandroid.R.style.Theme
andandroid.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.EDIT: this does not answer the question, which was asking for
ScrollView
. This answer only works onAbsListView
and descendants (includingListView
).Fading edge color is controlled by the
android:cacheColorHint
attribute.E.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 want a different color fading edge than the background, you have to override the ScrollView's getSolidColor() method. For example:
You can use this:
https://github.com/AndroidAlliance/EdgeEffectOverride
Simple clean and working perfect!
Just found it out by trial and error.
Simply set
android:background="@color/yourColor"
for the<ScrollView>
. It will set the shadow to the given colour.You can use: