Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

java - how do I add a custom layout to a Linear Layout on the click of a button

So I am trying to create a task app, in which, on the click of a button, I want my subtask custom view, which contains a text view, and 2 image views, inside a horizontal linear layout, to be displayed inside a vertical linear layout. The data required for the subtask is taken from a different activity, and then transferred using intents. Also, I need the id for every subtask that is added to be different. I have no idea how to do this. Please help. I couldn't code anything for this. I tried using layout inflater, searched up the net on what to do, but I still have no clue. Please help.

question from:https://stackoverflow.com/questions/65660917/how-do-i-add-a-custom-layout-to-a-linear-layout-on-the-click-of-a-button

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can user dialog fragment for this and is look effective also Let me give you link... dialog fragment


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...