diff --git a/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerSection.java b/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerSection.java
index b8f5d39..cb47280 100644
--- a/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerSection.java
+++ b/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerSection.java
@@ -22,7 +22,7 @@ public class IndexFastScrollRecyclerSection {
private float mIndexbarWidth;
private float mIndexbarMargin;
- private float mPreviewPadding ;
+ private float mPreviewPadding;
private float mDensity;
private float mScaledDensity;
private int mListViewWidth;
@@ -41,6 +41,7 @@ public class IndexFastScrollRecyclerSection {
private int setIndexBarCornerRadius = IndexFastScrollRecyclerView.mIndexBarCornerRadius;
private float setIndexBarTransparentValue = IndexFastScrollRecyclerView.mIndexBarTransparentValue;
private String indexbarBackgroudColor = IndexFastScrollRecyclerView.mIndexbarBackgroudColor;
+ private String indexbarTextColor = IndexFastScrollRecyclerView.mIndexbarTextColor;
private int indexbarBackgroudAlpha = (int) (255 * setIndexBarTransparentValue);
@@ -93,7 +94,7 @@ public void draw(Canvas canvas) {
}
Paint indexPaint = new Paint();
- indexPaint.setColor(indexPaintPaintColor);
+ indexPaint.setColor(Color.parseColor(indexbarTextColor));
indexPaint.setAntiAlias(true);
indexPaint.setTextSize(setIndexTextSize * mScaledDensity);
@@ -244,4 +245,11 @@ public void setIndexBarColor(String color) {
indexbarBackgroudColor = color;
}
+ /**
+ * @param color The color for the scroll track
+ */
+ public void setIndexBarTextColor(String color) {
+ indexbarTextColor = color;
+ }
+
}
\ No newline at end of file
diff --git a/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerView.java b/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerView.java
index 2a04a7e..0481043 100644
--- a/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerView.java
+++ b/alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerView.java
@@ -24,6 +24,7 @@ public class IndexFastScrollRecyclerView extends RecyclerView {
public static int mIndexBarCornerRadius = 5;
public static float mIndexBarTransparentValue = (float) 0.6;
public static String mIndexbarBackgroudColor = "#000000";
+ public static String mIndexbarTextColor = "#FFFFFF";
public IndexFastScrollRecyclerView(Context context) {
super(context);
@@ -59,6 +60,10 @@ private void init(Context context, AttributeSet attrs) {
mIndexbarBackgroudColor = typedArray.getString(R.styleable.IndexFastScrollRecyclerView_setIndexBarColor);
}
+ if (typedArray.getString(R.styleable.IndexFastScrollRecyclerView_setIndexBarTextColor) != null) {
+ mIndexbarTextColor = typedArray.getString(R.styleable.IndexFastScrollRecyclerView_setIndexBarTextColor);
+ }
+
} finally {
typedArray.recycle();
}
@@ -170,4 +175,11 @@ public void setIndexBarColor(String color) {
mScroller.setIndexBarColor(color);
}
+ /**
+ * @param color The color for the text in scroll track
+ */
+ public void setIndexBarTextColor(String color) {
+ mScroller.setIndexBarTextColor(color);
+ }
+
}
\ No newline at end of file
diff --git a/alphabetsindexfastscrollrecycler/src/main/res/values/attrs.xml b/alphabetsindexfastscrollrecycler/src/main/res/values/attrs.xml
index 1691ebd..44bd1f3 100644
--- a/alphabetsindexfastscrollrecycler/src/main/res/values/attrs.xml
+++ b/alphabetsindexfastscrollrecycler/src/main/res/values/attrs.xml
@@ -8,5 +8,6 @@
+
\ No newline at end of file
diff --git a/app/src/main/java/in/myinnos/indexfastscrollrecycler/MainActivity.java b/app/src/main/java/in/myinnos/indexfastscrollrecycler/MainActivity.java
index 8cfbc1d..19ca3b9 100644
--- a/app/src/main/java/in/myinnos/indexfastscrollrecycler/MainActivity.java
+++ b/app/src/main/java/in/myinnos/indexfastscrollrecycler/MainActivity.java
@@ -62,5 +62,6 @@ protected void initialiseUI() {
mRecyclerView.setIndexbarMargin(0);
mRecyclerView.setIndexbarWidth(40);
mRecyclerView.setPreviewPadding(0);
+ mRecyclerView.setIndexBarTextColor("#FFFFFF");
}
}
\ No newline at end of file