So this is a short and easier way to bind String Array to ListView. Using the entries attribute, we don’t need to make an Adapter object in our Java coding and setting it to the ListView. This String Array I created earlier in our project’s Strings.xml file. In the ListView, I specified the entries attribute and the string array as a value of it. The id of the RelativeLayout is taken as “rl_custom_layout”.Īnd finally, a ListView is used in the RelativeLayout for displaying the items as scrollable and selectable. A RelativeLayout is taken as child layout of CardView with match_parent value of layout width and height. In the above image, I have taken CardView as a root view with 10 max elevations and layout width and layout height with match_parent value.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |