Android, add new view without XML Layout

前端 未结 1 1111
日久生厌
日久生厌 2020-12-10 20:24

I need a little help from people with expirience. I hope it\'s easy. I just want to show new View (creating it without XML layouts) above main

相关标签:
1条回答
  • 2020-12-10 20:42

    You haven't actually told the system to draw anything or where to draw it. You'll want to look at the documentation for setContentView(view) on your Activity. If you're trying to get this to draw over your current screen, look at the documentation for Dialog (and setContentView).

    When I'm programmatically creating arbitrary views to draw within an existing layout, I usually add a FrameLayout tag to my layout XML, then in the code call findViewById(), then I can use that FrameLayout view to add the view to (addView()).

    I hope that helps some without writing your code for you.

    0 讨论(0)
提交回复
热议问题