Floating Action Button does not responds when it clicked/touched

前端 未结 2 1233
小鲜肉
小鲜肉 2020-12-14 22:09

I am using a floating action button(FAB) in my application to show Dialogs, everything is worked just fine when I tested my app in Xperia Z with Lopllipop 5.1.1.
However

相关标签:
2条回答
  • 2020-12-14 23:01

    The problem in here is that I declared the FAB before the declaration of listView. Somehow by relocating the declaration of FAB after the the declaration of listView it will solved the problem.
    From:

    <android.support.design.widget.FloatingActionButton
        ...
        ...
        .../>
    <ListView
        ...
        ...
        .../>
    

    To:

    <ListView
        ...
        ...
        .../>
    <android.support.design.widget.FloatingActionButton
        ...
        ...
        .../>
    

    Just as simple as that.

    0 讨论(0)
  • 2020-12-14 23:04

    Programmatically bringing the FAB to front should also work:

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.bringToFront();
    fab.setOnClickListener... //etc
    
    0 讨论(0)
提交回复
热议问题