0
Dialog
을 만들었습니다. Dialog
제목 색상과 분배기 색상을 변경하고 싶습니다. 나는 많은 대답을했지만 여전히 성공적이지 못했다.Android 대화명 및 구분선 색상이 변경되지 않습니다.
내가 좋아하는 다른 방법을 시도 :
int titleDividerId = resources.getIdentifier("titleDivider", "id", "android");
View titleDivider = dialog.getWindow().getDecorView().findViewById(titleDividerId);
titleDivider.setBackgroundColor(R.color.Red);
을 그리고 다음 코드를 사용 : 파란색에서만 위의 코드를 작동하지 않습니다
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.alertdialog_caseadd);
dialog.setTitle("Add new court");
final Resources res = getResources();
final int titleDividerId = res.getIdentifier("titleDivider", "id", "android");
inal View titleDivider = dialog.findViewById(titleDividerId);
titleDivider.setBackgroundColor(res.getColor(android.R.color.holo_orange_dark));
dialog.getWindow().setBackgroundDrawableResource(R.drawable.alerttitle);
final EditText casetype= (EditText) dialog.findViewById(R.id.text);
Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
Button dialogButtoncancel = (Button) dialog.findViewById(R.id.dialogButtoncancel);
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(casetype.getText().toString().equals(""))
Alert.showError("Error", "Please enter case type", CaseType.this);
else
if(Network.isOnline(getApplicationContext()))
new WebTask().execute();
else
Alert.showNetworkError(CaseType.this,inflater);
dialog.dismiss();
}
});
dialog.show();
dialogButtoncancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
그건, 분할 라인과 제목 색상을 보여줍니다. 변경하십시오.