55import static com .roy .sqlite3 .utils .AndroidUtil .sp ;
66
77import android .content .Context ;
8+ import android .graphics .Color ;
89import android .text .InputFilter ;
910import android .text .InputType ;
1011import android .text .TextUtils ;
@@ -72,7 +73,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
7273 int y = t + dp (16 );
7374 for (int i = 0 ; i != childCount ; ++i ) {
7475 final View child = getChildAt (i );
75- child .layout (x , y , x + child .getMeasuredWidth (), y += child .getMeasuredHeight ());
76+ child .layout (x , y , x + child .getMeasuredWidth () - dp ( 24 ) , y += child .getMeasuredHeight ());
7677 y += dp (8 );
7778 }
7879 }
@@ -90,7 +91,7 @@ public Student getStudent() {
9091 return null ;
9192 }
9293 final Student copy = student .clone ();
93- final String name = copy . getName ();
94+ final String name = editName . getText (). toString ();
9495 if (!TextUtils .isEmpty (name )) {
9596 copy .setName (name );
9697 }
@@ -109,9 +110,15 @@ private static EditText createEditText(final Context context) {
109110 final EditText editText = new EditText (context );
110111 final LayoutParams layoutParams = new LayoutParams (-1 , -2 );
111112 editText .setBackground (makeShape (0 , 4 , 0xffefeff4 , 1 ));
112- editText .setTextSize (TypedValue .COMPLEX_UNIT_PX , sp (16 ));
113+ editText .setTextSize (TypedValue .COMPLEX_UNIT_PX , sp (18 ));
113114 editText .setPadding (dp (8 ), dp (8 ), dp (8 ), dp (8 ));
114115 editText .setSingleLine (true );
116+ editText .setTextColor (Color .BLACK );
117+ editText .setOnFocusChangeListener ((v , hasFocus ) -> {
118+ if (hasFocus ) {
119+ editText .setSelection (editText .getText ().length ());
120+ }
121+ });
115122 editText .setImeOptions (EditorInfo .IME_ACTION_NEXT );
116123 editText .setInputType (InputType .TYPE_CLASS_TEXT );
117124 editText .setLayoutParams (layoutParams );
0 commit comments