【问题标题】:How to make SingleChoiceItem on AlertDialog looks more compact?如何使 AlertDialog 上的 SingleChoiceItem 看起来更紧凑?
【发布时间】:2013-04-01 07:10:37
【问题描述】:

默认的 AlertDialog 具有更大的 textSize 和更大的填充。

我可以像这样使用 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 的垂直间距/内边距?下面的样式不会影响任何东西。或者至少我们也可以调整 RadioButton 的大小?

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

这条线是我想使用带有样式自定义的默认 AlertDialog。我不想创建自定义适配器只是为了为 AlertDialog 制作自定义视图。

谢谢

【问题讨论】:

  • 我在尝试设置 AlertDialog 复选框的样式时发现了类似问题。并非默认中的所有项目都可以设置样式。您必须继续制作完整的自定义对话框,包括布局等。

标签: android styles customization android-alertdialog


【解决方案1】:

我想除了使用适配器构建完整的自定义对话框之外别无选择。还是谢谢。

【讨论】:

    猜你喜欢
    • 2013-09-06
    • 1970-01-01
    • 2022-12-15
    • 2021-07-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-12
    • 2017-07-03
    • 2023-03-14
    相关资源
    最近更新 更多