3
AlertDialog Builderにタイトルを追加しようとしています。テーマを追加すると、タイトルが選択領域に移動します。ここ
最初の例である:AlertDialog Builderにテーマを適用すると、タイトルが正常に動作しなくなる
classificationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(
new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Dialog));
//building my selection options
builder.setItems(classificationList, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String desiredClassification = classificationList[which];
if (!getClassification().equals(desiredClassification)) {
CallsignContract.updateClassification(desiredClassification, mContext);
setClassification(desiredClassification);
classificationButton.setText(desiredClassification);
}
}
});
builder.setTitle(R.string.classification_alert_header)
.create().show();
}
});
これは結果です。この第二の試みで
、私はビルダーからalertdialogを作成していることにタイトルを付けます。結果は正しいタイトルですが、タイトルは選択エリアに再び表示されます。
classificationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(
new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Dialog));
//building my selection options
builder.setItems(classificationList, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String desiredClassification = classificationList[which];
if (!getClassification().equals(desiredClassification)) {
CallsignContract.updateClassification(desiredClassification, mContext);
setClassification(desiredClassification);
classificationButton.setText(desiredClassification);
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setTitle(R.string.classification_alert_header);
alertDialog.show();
}
});
ありがとうございます!
あなたのタイトルは 'clasificationList'配列内にありませんか? –
@UilqueMessiasいいえclassificationList配列には、Not specified、Unclassified、Confidential、およびSecretのみが含まれます。 – RYDiiN