如何使AlertDialog上的SingleChoiceItem看起来更紧凑



默认AlertDialog具有更大的textSize和更大的padding。

我可以通过像这样使用Style来控制textSize

ContextThemeWrapper cw = new ContextThemeWrapper( this, R.style.AlertDialogTheme );
AlertDialog.Builder builder = new AlertDialog.Builder(cw);
然后

<style name="AlertDialogTheme" parent="android:Theme.Dialog">
    <item name="android:textSize">18sp</item>
</style>

现在如何调整AlertDialog的垂直间距/填充?下面的样式不影响任何东西。或者至少我们也可以调整单选按钮的大小?

<style name="AlertDialogTheme" parent="android:Theme.Dialog">
    <item name="android:paddingTop">0dp</item>
    <item name="android:paddingBottom">0dp</item>
</style>

这行是我想使用默认的AlertDialog与样式定制。我不想创建自定义适配器只是为AlertDialog创建自定义视图。

谢谢

我想没有比使用适配器构建完整的自定义对话框的选择了。谢谢。

相关内容

最新更新