Reputation: 3063
I am trying to setup a CollapsingToolbarLayout
with multiple view, but because CollapsingToolbarLayout
extends FrameLayout
I cant place view in the right order.
This is what I am trying to achieve: Expanded view:
_____________________________
|Title toolbar x|
|TextView A |
|TextView B |
|TextView C |
|SearchView |
|-----------------------------|
|RecyclerView content |
|... |
|... |
|... |
|... |
|... |
|... |
|_____________________________|
Collapsed View:
_____________________________
|Title toolbar x|
|SearchView |
|-----------------------------|
|RecyclerView content |
|... |
|... |
|... |
|... |
|... |
|... |
|... |
|... |
|... |
|_____________________________|
How do I place multiple views inside CollapsingToolbarLayout
in vertical order (TextView A
, TextView B
, TextView C
, SearchView
), and set only the SearchView to be pinned?
Upvotes: 1
Views: 305
Reputation: 16976
How do I place multiple views inside
CollapsingToolbarLayout
in vertical order (TextView
A,TextView
B,TextView
C,SearchView
)
You have to choose what you're good at it.
LinearLayout
and the other widgets inside with android:orientation="vertical"
.RelativeLayout
and android:layout_below
.ConstraintLayout
and constraints like layout_constraintTop_toBottomOf
.set only the
SearchView
to be pinned?
Using app:layout_collapseMode="pin"
will help to pin the SearchView
at the top while scrolling the content.
P.S: You may have to place it outside of the CollapsingToolbarLayout
.
Upvotes: 1