创建覆盖活动

2023-09-12 05:56:32 作者:ジ失去焦点的眼神ミ

我想创建一个叠加的活动是坐在屏幕以屏幕的一小部分的一角,而屏幕的其余部分是互动是我点击任何东西,其中显示在其他地区屏幕。到目前为止,我成功获得我的目标。我已经添加了这些属性,我的窗口,但他们似乎并没有工作。

I am trying to create a overlay activity which is sitting in a corner of the screen taking a very small portion of the screen, while the rest of the screen is interactive that is I tap on anything that is displaying on rest of the screen. So far I am unsuccessful in obtaining my goal. I have added these properties to my window but they don't seem to work.

的hello.xml:

hello.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="50dp"
   android:layout_height="match_parent"
   android:orientation="vertical"
   android:id="@+id/tepp" >
</RelativeLayout>

我能做些什么来解决这个问题呢?

What can I do to solve this problem?

推荐答案

从我的记忆中,只有一个活动可在任何特定时间被激活。因此,尽管小活动在角落里运行,其他activitys将被暂停,你将无法与它们进行交互。你应该尝试使用片段的代替。可以有同时可见多个片段。虽然我相信只有一个片段可在任何给定的时间就像一个活动活跃,当你点击不同的片段,一个你点击被激活,你可以与它进行交互。这可能会帮助你实现你在寻找什么。

From what I can remember, only one Activity can be active at any given time. So while that small Activity in the corner is running, the other activitys will be paused and you wont be able to interact with them. You should try using a Fragment instead. You can have multiple fragments visible at the same time. Although I believe that only one Fragment can be active at any given time like an Activity, when you click on different fragments, the one you click on becomes active and you can interact with it. This might help you achieve what your looking for.

相关推荐