简体   繁体   中英

How do I make a list be printed as buttons in the xml file? (Android)

I want to make a loop that in my main.xml creates a button for each item in the list. But I cant see a way to loop in the xml file and create more buttons that way.

main.xml can't be changed by your program, any more than your Java source files.

What are you actually trying to do? Provide UI for a list? Take a look at ListAdapter .

There is no loop syntax for the xml layout. If it will be dynamic you have to do it programmatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM