0

I could use some help with merging multiple views into one, like Pinterest has at

a busy cat

I know how to make a reusable custom view, been searching around custom components, compound controls, checked sdk samples and threads like Custom view made of multiple views , but it was never the proper way. I want it to also show 1 view (where i can set the image/texts dynamically) at the hierarchy viewer instead of 5+ child subviews, as that way increases performance aswell. I checked the github acc of Pinterest too without success :)

Can I somehow achieve it, or Im way too off? Thanks!

Community
  • 1
  • 1
tibbi
  • 249
  • 4
  • 27

1 Answers1

0

Try creating a separate layout.xml file containing all of the views you want to have in your custom view. Then in java all you would have to do is make reference to each of those custom views and fill them with your data.

Ethan
  • 225
  • 2
  • 13
  • hello, I do have it like that currently, but in hierarchy viewer it acts as 6 views instead of 1, since I use imageview and textviews in the custom view. It has to be achievable some other way – tibbi Jan 25 '15 at 19:41
  • I'm not sure what you mean by "acts like 6 views instead of 1". Shouldn't everything act differently? If you want all the views to change at once you have to do that in Java when the user interacts with the app in some way (Which really wouldn't be that difficult). – Ethan Jan 25 '15 at 19:54
  • you can see on the given screenshot that the child subviews (imageviews and textviews) arent shown. The whole block looks like 1 view – tibbi Jan 25 '15 at 23:05