\n
Then here at the bottom of the page (arrows will be moved later):
\n\nThis is the XML code for the thumb:
\n<?xml version="1.0" encoding="utf-8"?>\n<layer-list xmlns:android="http://schemas.android.com/apk/res/android">\n\n <item\n android:drawable="@drawable/ic_scroll_thumb_bmp"\n android:gravity="center"\n android:left="100dp"\n android:height="25dp">\n <margin android:top="50dp" />\n </item>\n\n</layer-list>\n
\nI tried using the android:top and android:bottom values to move it around, but I could only get it to stay either within bounds on the top, or within bounds on the bottom, but not both. I saw some older usages online that suggest padding and/or margins would work in these, but after attempting to do so, nothing happened, as well as the IDE telling me it "wasn't allowed here".
\nHow would I bound the thumb within the track? Are there values in layer-list or layer-list > item that would help me do so?
\n","author":{"@type":"Person","name":"mbob98"},"upvoteCount":0,"answerCount":0,"acceptedAnswer":null}}Reputation: 71
I have been at work implementing a custom scrollbar for views, and have revisited the layer-list idea I found, since it seems to have a bigger chance of being a viable solution than I thought. My issue, however, is that I've lined up the thumb's layer-list item with the track's layer-list item underneath, but I can't keep it on the track.
Here's what my scrollbar looks like when it's at the top of the page (arrows will be moved later):
Then here at the bottom of the page (arrows will be moved later):
This is the XML code for the thumb:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_scroll_thumb_bmp"
android:gravity="center"
android:left="100dp"
android:height="25dp">
<margin android:top="50dp" />
</item>
</layer-list>
I tried using the android:top and android:bottom values to move it around, but I could only get it to stay either within bounds on the top, or within bounds on the bottom, but not both. I saw some older usages online that suggest padding and/or margins would work in these, but after attempting to do so, nothing happened, as well as the IDE telling me it "wasn't allowed here".
How would I bound the thumb within the track? Are there values in layer-list or layer-list > item that would help me do so?
Upvotes: 0
Views: 94