Material-dialogs: CustomView with ListView doesn't scroll

Created on 17 Oct 2015  路  7Comments  路  Source: afollestad/material-dialogs

Hey,

I've added a custom view to my dialog, basically it looks like this:

    <LinearLayout>

     <ListView/>

    <LinearLayout>

        <TextView/>
        <TextView/>

    </LinearLayout>

    <LinearLayout>

        <TextView/>
        <TextView/>

    </LinearLayout>

    <LinearLayout>

        <TextView/>
        <TextView/>

    </LinearLayout>

    <View/>

    <LinearLayout>

        <TextView/>
        <TextView/>

    </LinearLayout>

    <LinearLayout>

        <TextView/>
        <TextView/>

    </LinearLayout>

    </LinearLayout>

Problem is, I can't scroll. I've set

       .customView(R.layout.xyz, false)

When set in on true to wrap it in a scroll view it's working great and I can scroll, but I get some paddings, which I don't want. Does anyone has an idea why I can't scroll with my first mentioned solution or tell me how I can wrap it in a scroll view like the customView function does, just without getting the paddings?

Thanks!

Most helpful comment

Maybe try it with a NestedScrollView instead of a ScrollView?

All 7 comments

Wrapping in a ScrollView literally means wrapping your content in a ScrollView 馃槣

<ScrollView>

        <LinearLayout>

                // Children here

        </LinearLayout>

</ScrollView>

Oh, but there's a ListView in there too. It'll scroll once the dialog is at max height, in my experience. But you can't put a ListView inside of a ScrollView without issues.

Yeah, that's the point, if I literally wrap my Layout in a Scrollview I get an error. But with your wrapInScrollView variable it works?

screenshot_2015-10-18-12-42-04

It seems the max height is reached, but I just can't scroll.

Hmmm, that's very odd. I'll look into it.

Maybe try it with a NestedScrollView instead of a ScrollView?

Try to add this to ListView:

android:layout_height="0dp"
android:layout_weight="1"

I believe this will no longer apply with v2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarthak1996 picture sarthak1996  路  6Comments

jahirfiquitiva picture jahirfiquitiva  路  6Comments

SixianOne picture SixianOne  路  5Comments

bernaferrari picture bernaferrari  路  5Comments

ghost1372 picture ghost1372  路  5Comments