0

Is there any way to assign double bottom_toBottomOf in an ImageView? I have a layout that I have something like a FloatingActionButton and I want to be always above of my two views. I started doing the list and it works because I've added in the FAB bottom_toBottomOf="idRecyclerView" but the problem is now that I've added another view, the FAB doesn't put above of that view because it's aligned to the recyclerView.

Note : RecyclerView and View are visibility=gone since start, depending on the data I enable the RecyclerView or the View so, when I initialise the RecyclerView it works and the FAB is above of the list, but when I initialise the View the button remains to the bottom because the RecyclerView is gone (aligned to the bottom).

This is an example of what I have right now enter image description here

When I have the list since the FAB has the bottom_bottomOf=recycler it works, but when I show the View the FAB is in the bottom, and I'm wondering if is there any way to add like double bottom_bottomOf so always the FAB will stay above the view no matter if it's the recyclerView or the View

StuartDTO
  • 783
  • 7
  • 26
  • 72
  • Please ask the question properly, so I can help. Share the images for reference like what you want and what you have. I don't even know where your `RecyclerView` is? – MojoJojo Jul 20 '22 at 14:03
  • 1
    Use a barrier that is on top of the two view. See [Barrier](https://developer.android.com/reference/androidx/constraintlayout/widget/Barrier). – Cheticamp Jul 20 '22 at 14:18
  • bottom_bottomOf ="parent" to the fab.. – Gobu CSG Jul 20 '22 at 16:12

1 Answers1

0

You're changing the position of your FAB dynamically, in that case you need to achieve this programmatically. Refer to this answer to learn how to change view constrains in code. Execute it right after changing the visibility of your views.