Skip to content

Commit

Permalink
支持设置顶部按钮按下状态的文字颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
liyujiang-gzu committed Dec 21, 2016
1 parent 6d8ec7f commit c9b89b9
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public abstract class ConfirmPopup<V extends View> extends BasicPopup<View> {
protected int cancelTextColor = Color.BLACK;
protected int submitTextColor = Color.BLACK;
protected int titleTextColor = Color.BLACK;
protected int pressedTextColor = 0XFF0288CE;
protected int cancelTextSize = 0;
protected int submitTextSize = 0;
protected int titleTextSize = 0;
Expand Down Expand Up @@ -158,6 +159,13 @@ public void setTitleTextColor(@ColorInt int titleTextColor) {
this.titleTextColor = titleTextColor;
}

/**
* 设置按下时的文字颜色
*/
public void setPressedTextColor(int pressedTextColor) {
this.pressedTextColor = pressedTextColor;
}

/**
* 设置顶部标题栏取消按钮文字大小(单位为sp)
*/
Expand Down Expand Up @@ -239,7 +247,7 @@ protected View makeHeaderView() {
if (!TextUtils.isEmpty(cancelText)) {
cancelButton.setText(cancelText);
}
cancelButton.setTextColor(cancelTextColor);
cancelButton.setTextColor(ConvertUtils.toColorStateList(cancelTextColor, pressedTextColor));
if (cancelTextSize != 0) {
cancelButton.setTextSize(cancelTextSize);
}
Expand Down Expand Up @@ -281,7 +289,7 @@ public void onClick(View v) {
if (!TextUtils.isEmpty(submitText)) {
submitButton.setText(submitText);
}
submitButton.setTextColor(submitTextColor);
submitButton.setTextColor(ConvertUtils.toColorStateList(submitTextColor, pressedTextColor));
if (submitTextSize != 0) {
submitButton.setTextSize(submitTextSize);
}
Expand Down

0 comments on commit c9b89b9

Please sign in to comment.