I am adding a ViewPager
to my app, together with an picture indicator.
I want the shape of the indicator to be a thin line instead of the usual dots.
For that, I have taken a reference from this answer here.
I have tried to modify the XML files given, like this:
default_dot.xml ---> default_line.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<solid android:color="@android:color/darker_gray"/>
<corners
android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
</item>
</layer-list>
selected_dot.xml -----> selected_line.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<solid android:color="@color/colorAccent"/>
<corners
android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
</item>
</layer-list>
And the file tab_selector.xml remains the same, just change the name of the corresponding xml files.
So, well, the result of all this, is that, the selected_line.xml
(the pink one) is showed, however, the default_line.xml
is not showed, so I can just see the pink like moving to the right/left as I swipe the pictures, but no default grey lines.