diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml index 254eaf0..deea96c 100644 --- a/example/src/main/res/layout/activity_main.xml +++ b/example/src/main/res/layout/activity_main.xml @@ -21,7 +21,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:cursorVisible="false" - app:forceKeyboard="true" + app:forceKeyboard="true" + app:textColor="#ff0000" app:hint="" app:inputType="number" app:password="false" diff --git a/pinview/src/main/java/com/goodiebag/pinview/Pinview.java b/pinview/src/main/java/com/goodiebag/pinview/Pinview.java index de6054a..05c9afb 100644 --- a/pinview/src/main/java/com/goodiebag/pinview/Pinview.java +++ b/pinview/src/main/java/com/goodiebag/pinview/Pinview.java @@ -72,14 +72,15 @@ public class Pinview extends LinearLayout implements TextWatcher, View.OnFocusCh /** * Attributes */ - private int mPinLength = 4; - private List editTextList = new ArrayList<>(); - private int mPinWidth = 50; - private int mTextSize = 12; - private int mPinHeight = 50; - private int mSplitWidth = 20; - private boolean mCursorVisible = false; - private boolean mDelPressed = false; + private int mPinLength = 4; + private List editTextList = new ArrayList<>(); + private int mPinWidth = 50; + private int mTextSize = 12; + private int mTextColor = getResources().getColor(android.R.color.black); + private int mPinHeight = 50; + private int mSplitWidth = 20; + private boolean mCursorVisible = false; + private boolean mDelPressed = false; @DrawableRes private int mPinBackground = R.drawable.sample_background; private boolean mPassword = false; @@ -184,6 +185,7 @@ private void createEditTexts() { for (int i = 0; i < mPinLength; i++) { editText = new EditText(getContext()); editText.setTextSize(mTextSize); + editText.setTextColor(mTextColor); editTextList.add(i, editText); this.addView(editText); generateOneEditText(editText, "" + i); @@ -207,6 +209,7 @@ private void initAttributes(Context context, AttributeSet attrs, int defStyleAtt mPinWidth = (int) array.getDimension(R.styleable.Pinview_pinWidth, mPinWidth); mSplitWidth = (int) array.getDimension(R.styleable.Pinview_splitWidth, mSplitWidth); mTextSize = (int) array.getDimension(R.styleable.Pinview_textSize, mTextSize); + mTextColor = array.getColor(R.styleable.Pinview_textColor, mTextColor); mCursorVisible = array.getBoolean(R.styleable.Pinview_cursorVisible, mCursorVisible); mPassword = array.getBoolean(R.styleable.Pinview_password, mPassword); mForceKeyboard = array.getBoolean(R.styleable.Pinview_forceKeyboard, mForceKeyboard); diff --git a/pinview/src/main/res/values/attrs.xml b/pinview/src/main/res/values/attrs.xml index 67169de..1b4ac5a 100644 --- a/pinview/src/main/res/values/attrs.xml +++ b/pinview/src/main/res/values/attrs.xml @@ -12,6 +12,7 @@ +