Which Layout do I need to use to create a single ListView item? when you try to insert something other than TextView into this template, departures occur in the application itself, it stops.
- oneany one can use. if your “crashes”, provide the frame-time at departure and the corresponding code. in the current form, your question cannot be answered with anything intelligible and useful - pavlofff
- ok, and do I need some kind of id to give the TextView, which will display the input text of the element? - Semyon Kotov
- if you are going to access it from code, then yes. - pavlofff
- and what? for ListView, it must be android: list, and here? - Semyon Kotov
- any, for the list is also not necessarily what you indicated. This resource does not imply a discussion in the comments. Design your question so that it reveals your real problem as much as possible, look at the code and error messages so that you can give a full answer to it - pavlofff
|
1 answer
I solved the problem. Initially, in my xml-template for a separate item in the list there was only one TextView, respectively, and all that had to be specified in the adapter is this same template.
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.new_task_element, data); But since I was going to create a layout and inside it is a TextView, it was necessary to specify the id of both the layout and the TextView inside it for the studio to recognize this very TextView.
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.new_task_element, R.id.text_element, data); Now you can insert anything you like into this template for a separate item in the list. My post is the only info in Russian on this issue.
|