The layout from alert dialog gets messed up with long scrollView

131 views Asked by At

I have an alert dialog which has a custom view. In this view I add checkboxes programmatically. The problem is that when I have like 30 checkboxes in my scroll view, the alert dialog's layout gets messed up. The message falls of the screen and the buttons from the dialog have weird padding.

The first image illustrates the layout that I want. The second one is my problem. first image with correct layout second image with wrong layout

How can I make sure that the second layout has the same 'header' and 'footer' as the first image?

dialog.xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout
    android:id="@+id/dialog_filter_brouwerij_linearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="25dp"
    android:layout_marginRight="25dp"
    android:orientation="vertical"
    android:paddingBottom="5dp"
    android:paddingTop="5dp">
</LinearLayout>

0

There are 0 answers