Nov 20 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Nov 20 | 9:15 AM |
ndrocchietto_ivano | has entered the room |
ndrocchietto_ivano |
HI mark
|
Mark M. |
hello, Ivano!
|
Mark M. |
how can I help you today?
|
ndrocchietto_ivano |
I have to resolve a legacy code problem
|
ndrocchietto_ivano |
I have a TabLayout with two different tabs. The initial Tab shows a CardView and want to place the @id/logo (the last item in the xml file) just below this Card. Namely if the user search for a term, I made the CardView invisible programmatically, and a RecyclerView will populate the screen below the RecyclerView and after the Recycler View will appear the logo, if instead the user presses the second tab, the RecyclerView will populate all the screen
|
ndrocchietto_ivano |
View paste
(114 more lines)
|
Nov 20 | 9:20 AM |
ndrocchietto_ivano |
and this is the include file
|
ndrocchietto_ivano |
View paste
(6 more lines)
|
Mark M. |
what is your question?
|
ndrocchietto_ivano |
how can I have on the first tab
|
ndrocchietto_ivano |
the google logo
|
ndrocchietto_ivano |
behind the recyclerView
|
ndrocchietto_ivano |
the problem is that when the tab starts :
|
ndrocchietto_ivano |
View paste
|
ndrocchietto_ivano |
and is selected SEARCHED LOCATION, I have also the cardView
|
ndrocchietto_ivano |
that become invisible as soon as the user write in the search field where the layout is wrapped
|
Nov 20 | 9:25 AM |
ndrocchietto_ivano |
I know is really difficult to understand
|
ndrocchietto_ivano |
and the view do too many things
|
Mark M. |
by "behind the recyclerView", are you referring to the addresses_rv RecyclerView?
|
ndrocchietto_ivano |
correct
|
Mark M. |
and by "behind", you mean on the Z axis?
|
ndrocchietto_ivano |
no
|
ndrocchietto_ivano |
I mean the google logo, basically the last attribute in the main xml file indicated as AppCompactView
|
ndrocchietto_ivano |
and for behind recycler view
|
ndrocchietto_ivano |
I mean below the recyclerView
|
ndrocchietto_ivano |
basically you have this search activity, and initially you have a card view with your own location, and the logo of google below
|
Mark M. |
it seems like @id/logo already is below @id/search_results_cv on the Y axis
|
ndrocchietto_ivano |
if the user makes a search then the cardView with your own location disappears and is loaded the recyclerView via <include showing at the end of the research the google logo
|
ndrocchietto_ivano |
finally if the user touch the second tab address, is opened a catalogue of adresses
|
ndrocchietto_ivano |
via the SAME recyclerView
|
Mark M. |
search_results_cv has app:layout_constraintBottom_toBottomOf="parent", so it will stretch to the bottom of the available space
|
ndrocchietto_ivano |
and in this second tab the google logo have to disappear
|
Nov 20 | 9:30 AM |
ndrocchietto_ivano |
this is correct in the second tab
|
Mark M. |
logo is trying to position itself below search_results_cv, which will not work, as there is no space there
|
ndrocchietto_ivano |
and also on the first one
|
ndrocchietto_ivano |
this is correct
|
ndrocchietto_ivano |
I am impressed you understood this use case
|
Mark M. |
I disagree that I understand the use case
|
ndrocchietto_ivano |
ahahah
|
Mark M. |
I am simply trying to make sense of your layout
|
ndrocchietto_ivano |
ok
|
ndrocchietto_ivano |
the problem is that should have two different behaviours depending by the tab clicked
|
ndrocchietto_ivano |
maybe I should do a wild refactoring
|
Mark M. |
either have two different ImageViews or change the layout rules for the existing ImageView at runtime, I guess
|
ndrocchietto_ivano |
ok thanks
|
ndrocchietto_ivano |
I should pass in <include
|
ndrocchietto_ivano |
in one case android:layout_height="wrap"
|
ndrocchietto_ivano |
app:layout_constraintBottom_toBottomOf="parent"/>
|
ndrocchietto_ivano |
and in another
|
ndrocchietto_ivano | |
ndrocchietto_ivano |
is that possible programmatically?
|
Mark M. |
you can change the rules associated with a child of ConstraintLayout using a ConstraintSet, if that is what you mean
|
Nov 20 | 9:35 AM |
ndrocchietto_ivano |
yes
|
Nov 20 | 9:35 AM |
ndrocchietto_ivano |
but the constant layout I want to change is inside this include
|
Mark M. |
at runtime, that should not matter much
|
Mark M. |
<include> is a layout inflater thing
|
ndrocchietto_ivano |
and I need to change also the heigt
|
ndrocchietto_ivano |
I see
|
Mark M. |
ConstraintSet also lets you control the height and width rules
|
ndrocchietto_ivano |
I see thank you for the hint
|
ndrocchietto_ivano |
I am gonna work on that
|
Nov 20 | 9:55 AM |
Mark M. |
any last questions?
|
Nov 20 | 10:00 AM |
ndrocchietto_ivano |
no fine\
|
ndrocchietto_ivano |
have a nice afternoon
|
ndrocchietto_ivano |
learned a lot today
|
ndrocchietto_ivano |
this is what matters
|
Mark M. |
OK, then, that's a wrap for today's chat
|
Mark M. |
the next chat is tomorrow at 7:30pm US Eastern
|
Mark M. |
have a pleasant day!
|
ndrocchietto_ivano | has left the room |
Mark M. | turned off guest access |