如何在android的对话框中设置按钮下方的空间?

时间:2017-10-13 02:26:12

标签: android android-layout alertdialog

我正在尝试使用两个按钮为我的git merge-file --ours/--theirs应用创建一个漂亮的对话框。我的问题是即使我设置了Android,按钮下面也没有空格。此对话框的布局为android:layout_marginBottom = 5dp,如下所示:

dialogbox.xml

任何人都可以帮我解决这个问题吗?这是我运行代码时对话框的屏幕截图:

Screenshot of Dialog box

2 个答案:

答案 0 :(得分:0)

尝试更改主根LinearLayout身高

您应该使用

android:layout_height="wrap_content"

而不是

android:layout_height="80dp"

更改您的布局,如下面的代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/curve_shap"
  android:orientation="vertical" >

答案 1 :(得分:0)

根据以下代码进行更改

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="80dp" //remove this
android:layout_height="wrap_content" //addthis
android:padding="10dp"//add this for space 
android:background="@drawable/curve_shap"
android:orientation="vertical" >