Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SnackBar above keyboard with FAB

I have a problem with my app: a strange behavior on Version >= Lollipop, due to AndroidBug5497Workaround.

I'm using coordinator layout, collapsing toolbar, fragments, floating action buttons and snackbar, everything works fine on pre-lollipop. I need to show my Fab over keyboard, and I use the AndroidBug5497Workaround. (according with Joseph Johnson's solution)

But with this solution the snackbar is getting crazy. I'm using all android's support libraries 23.2.+, and in my manifest I've set android:windowSoftInputMode="stateAlwaysHidden|adjustResize" for this activity

That's the structure of my activity :

<Coordinator Layout>
    <Collapsing Toolbar />
    <Linear Layout>
       <Fragment />
    </Linear Layout>
    <Floating Action Button />
</Coordinator Layout>

And that's the fragment:

<Linear Layout>
    <Nested Scroll View>
        <Linear Layout>
            <CardView 1/>
            <CardView 2/>
            <CardView n/>
        </Linear Layout>    
    </Nested Scroll View>
</Linear Layout>

Any help will be appreciate. Thanks a lot.

Normal Behavior without keyboard

Pre Lollipop Behavior Lollipop

like image 351
ArghArgh Avatar asked Nov 09 '22 18:11

ArghArgh


1 Answers

Try using following in the activity of your manifest

android:windowSoftInputMode="adjustResize"
like image 186
Ritesh Karmare Avatar answered Nov 14 '22 21:11

Ritesh Karmare