Skip to content

Commit 0b4221e

Browse files
committed
刚才有个值取错了
1 parent a5bfbe2 commit 0b4221e

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Built application files
2-
*.apk
32
*.aar
43
*.ap_
54
*.aab

app/release/app-release.apk

1.58 MB
Binary file not shown.

app/src/main/java/com/roy/sqlite3/widget/EditStudentView.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static com.roy.sqlite3.utils.AndroidUtil.sp;
66

77
import android.content.Context;
8+
import android.graphics.Color;
89
import android.text.InputFilter;
910
import android.text.InputType;
1011
import 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

Comments
 (0)