简体   繁体   English

将类添加到android的弹出窗口

[英]Add class to pop-up window in android

I have a class MAIN activity with its xml VIEW, and also a pop-up xml VIEW. 我有一个带有XML VIEW的类MAIN activity ,还有一个弹出的XML VIEW。

I was wondering if there was anyway possible to assign to the pop-up VIEW its own CLASS rather than having to create its interactions in the MAIN activity class. 我想知道是否有可能将弹出窗口VIEW分配给自己的CLASS,而不是必须在MAIN活动类中创建其交互。

In few words, if class A (main activity) has its view A-VIEW , how can I make the pop up window B-VIEW have its own activity class B ? 简而言之,如果A类(主要活动)具有其视图A-VIEW ,那么如何使弹出窗口B-VIEW具有其自己的活动类B

how can I make the pop up window 'B-VIEW' have its own activity class B? 如何使弹出窗口“ B-VIEW”具有自己的活动类别B?

Yes, you can make two views with two separate activities. 是的,您可以通过两个单独的活动制作两个视图。 This is very common. 这是很常见的。 You should google something like "start another activity". 您应该在Google上搜索“开始另一项活动”之类的内容。 However, an activity covers the entire screen. 但是,活动覆盖整个屏幕。 It will not display as a popup. 它不会显示为弹出窗口。 To create a popup, you should use Dialog and DialogFragment. 要创建弹出窗口,应使用Dialog和DialogFragment。 Again use google to find more information. 再次使用Google查找更多信息。 You should also learn about fragments because they are commonly used to organize layouts in to reusable chunks. 您还应该了解片段,因为它们通常用于将布局组织成可重用的块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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