0

I have some dialog_alert.xml

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorWhite">

    <LinearLayout
        android:id="@+id/cv"
        android:layout_width="match_parent"
        android:layout_gravity="center"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:elevation="4dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/colorAccent"
                android:gravity="center"
                android:padding="15dp"
                android:text="@{vm.title}"
                android:textColor="@color/colorWhite"
                android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
            <ProgressBar
                style="@style/ProgresBarTop"
                android:indeterminate="@{vm.working}"
                android:layout_margin="0dp"
                android:padding="0dp"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:padding="15dp"
                android:text="@{vm.message}"
                android:textColor="@color/colorBlack" />


        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal" >
        <Button
            style="@style/ActionButton"
            android:layout_gravity="center_horizontal"
            android:text="@string/ok"
            android:onClick="@{v-> vm.okClick(v)}"/>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

and in the viewmodel

AlertDialog ad = new AlertDialog(context, R.string.synchro, sb.toString()
                        , SYNC_COMPLETE_DIALOG);

ad.show();

And when this alert show up with the message to big to show on the screen I can't move the screen to the bottom of the message. It is blocked. Alert doesn't react to touchscreen to move down to the rest of the message.

Any ideas how to fix that?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Grimmjow
  • 3
  • 3

1 Answers1

0

If you wrap your layout in a <ScrollView> you can scroll the dialog contents up and down. For example, in your XML, use something like this:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- YOUR EXISTING LAYOUT CODE GOES HERE -->

</ScrollView>
Tyler V
  • 9,694
  • 3
  • 26
  • 52