简体   繁体   中英

Android - How do I move my button programmatically in a grid layout?

I'm making an android app where if you click on a Button , it will create a Textview . But my problem is that when the TextView is placed inside the GridLayout , the Button stays where it is. I want to move the button relative to where the TextView is placed.

Your TextView in the GridLayout is controlled by the GridLayout , GridLayout works in a different way as compared to other ViewGroup s-afaik, an ex of gridlayout you will see that it uses column and row , so if you want to achieve what you want to achieve alter its column to the prefered place.

to be safe use a different Viewgroup

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