Dialog content style

I have SingleChoiceItems Dialog:

AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.AlertDialogCustom));
builder.setTitle("Выберите статус:")
        .setSingleChoiceItems(mStatusesAdapter, 0, null)
        .setPositiveButton("Подтвердить", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {

            }
        })
        .setNegativeButton("Отмена", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {

            }
        });
builder.show();

In this dialog I use my style, where I can manage title, actions, etc.

<style name="AlertDialogCustom" parent="@android:style/Theme.Material.Light.Dialog.Alert" tools:targetApi="lollipop">
</style>

But I can't manage my content in dialog. How can I change content size?

Thanks.

UPDATE

I explain my question.

.setSingleChoiceItems(mStatusesAdapter, 0, null)

Adapter code:

private ArrayList<Status> mStatuses;
private ArrayAdapter<String> mStatusesAdapter;

private class LoadInfoModel{
public ArrayList<Status> statuses;
}

loadInfoModel.statuses = DataGetHelpers.GetStatuses();

mStatuses = loadInfoModel.statuses;
    ArrayList<String> statusesTitles = new ArrayList<>();

    for (int i = 0; i < mStatuses.size(); i++){
    statusesTitles.add(mStatuses.get(i).StatusTitle);
    }
    mListViewStatuses = new ListView(getActivity());
    mStatusesAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.select_dialog_singlechoice, statusesTitles);
    mListViewStatuses.setAdapter(mStatusesAdapter);

I bring an adapter to display the contents of my dialog, and result: enter image description here

This items have big size for me, how can I change their size?

Answer

Just need use custom layout for your adapter where set text size.

Upvotes: 1

Views: 138

Answers (2)

brahmy adigopula
brahmy adigopula

Reputation: 617

try like this to change the title content...

AlertDialog dialog = new AlertDialog.Builder(this).setMessage("Hello world").show();
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
textView.setTextSize(40);

Upvotes: 0

Amit Bhati
Amit Bhati

Reputation: 1405

You can Customise text completely, Try Below code-

TextView title =  new TextView(context);
        title.setText("ALERT TITLE");
        title.setTextSize(50);
        title.setBackgroundColor(Color.GRAY);
        title.setTextColor(Color.WHITE);
    builder.setCustomTitle(title);

Will work for You :)

Upvotes: 1

Related Questions