Good day. I interact with VC and get a json line in which it says that I have the first post and it contains a picture, text and video. After CardView the data, I want to add CardView to my program in which there will be this data. I was advised to make a custom view through an xml file, that is, to distribute in xml everything that can be and after that add this component to my main activation. Question: if in the custom view (xml) file, I will have an ImageView && TextView nakazan, and after parsing the response line, I need to add only CardView (also CardView as custom view, it’s an xml file) in which there will be only text or only a picture as such to reach? Maybe it is better to create each component programmatically, if so, it will be a lot of conditions? How best to make and preferably small primerchik. Thank.
- oneit depends on how the markup will look like. In any case, in xml, create a layout that will be used, there you can precisely adjust the location of elements and their dependencies, set the visibility to gone, change the visibility in case of receiving data and show if there is a need, if there is no data, make a template in TextView, for example, "Empty ". It all depends on the desired result, and you will have to programmatically do the data you get in the process, there are also a lot of options. In general, the question cannot be answered specifically - Shwarz Andrei
- @ShwarzAndrei, and then stupidly for me to check each element with the ifes? - Diha-o
|