由于没有封装到之前的pop库,所以我就直接用AlertDialog原生的弹窗来搞了。然后坚定修改了下样式,快速完成了项目!后面再统一封装吧...
效果 - 紫色框就是做的修改...
image
So.
1. 自定义标题样式
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext);
// 自定义title,主要是为了居中
LayoutInflater layoutInflater = LayoutInflater.from(mContext);
View mTitleView = layoutInflater.inflate(R.layout.alertdialog_title, null);
((TextView)mTitleView.findViewById(R.id.txtPatient)).setText("申报状态选择");
alertBuilder.setCustomTitle(mTitleView);
alertdialog_title.xml
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/patient_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_all_bg"
app:layout_constraintTop_toTopOf="parent">
android:id="@+id/txtPatient"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:text="请选择项目地区"
android:textColor="@color/black_all_text"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
2. 确定、取消颜色
alertDialogPlace = alertBuilder.create();
alertDialogPlace.show();
alertDialogPlace.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.GRAY);
alertDialogPlace.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.BLACK);
3. 多选列表框颜色修改,界面style里面增加colorControlNormal和colorControlActivated
@color/white
@color/gray_f
@color/green_all_bg
设置给当前界面(记得是当前界面哟,而不是Application)
image