Getting default padding for AlertDialog

后端 未结 3 769
灰色年华
灰色年华 2021-02-02 05:40

I need to make a AlertDialog with a custom view. The message of a AlertDialog has a default padding but when i set a view it has no padding, i wand to

3条回答
  •  长情又很酷
    2021-02-02 06:27

    The ?dialogPreferredPadding attribute now has this value. It was introduced in API 22; see https://developer.android.com/sdk/api_diff/22/changes/android.R.attr.html.

    You can get consistent padding in your custom dialogs by specifying this attribute on the dialog's layout. For example, android:paddingLeft="?dialogPreferredPadding" will bring the dialog's contents into alignment with its title.

提交回复
热议问题