@@ -65,6 +65,7 @@ public class CodeEditText extends EditText {
6565 private boolean showCursor ;// 是否显示光标
6666 private int cursorDuration ;// 光标闪烁间隔
6767 private int cursorWidth ;// 光标宽度
68+ private int cursorHeight ;// 光标高度
6869 @ ColorInt
6970 private int cursorColor ;// 光标颜色 没有设置时默认字体颜色
7071
@@ -129,9 +130,10 @@ private void parseAttrs(Context context, AttributeSet attrs, int defStyleAttr, i
129130
130131 showCursor = typedArray .getBoolean (R .styleable .CodeEditText_showCursor , false );
131132 cursorDuration = typedArray .getInteger (R .styleable .CodeEditText_cursorDuration , 500 );
132- cursorWidth = typedArray .getDimensionPixelSize (R .styleable .CodeEditText_blockCorner , dp2px (1 ));
133+ cursorWidth = typedArray .getDimensionPixelSize (R .styleable .CodeEditText_cursorWidth , dp2px (1 ));
134+ cursorHeight = typedArray .getDimensionPixelSize (R .styleable .CodeEditText_cursorHeight , (int ) (codeTextSize * 1.25f ));
133135 cursorColor = typedArray .getColor (R .styleable .CodeEditText_cursorColor , blockNormalColor );
134- cursorDrawer = createCursorDrawer (showCursor , cursorDuration , cursorWidth , cursorColor );
136+ cursorDrawer = createCursorDrawer (showCursor , cursorDuration , cursorWidth , cursorHeight , cursorColor );
135137 typedArray .recycle ();
136138 }
137139
@@ -144,8 +146,8 @@ private void parseAttrs(Context context, AttributeSet attrs, int defStyleAttr, i
144146 * @param cursorColor
145147 * @return
146148 */
147- private CursorDrawer createCursorDrawer (boolean showCursor , int cursorDuration , int cursorWidth , int cursorColor ) {
148- return new CursorDrawer (showCursor , cursorDuration , cursorWidth , cursorColor );
149+ private CursorDrawer createCursorDrawer (boolean showCursor , int cursorDuration , int cursorWidth , int cursorHeight , int cursorColor ) {
150+ return new CursorDrawer (showCursor , cursorDuration , cursorWidth , cursorHeight , cursorColor );
149151 }
150152
151153 /**
0 commit comments