Java 设备主屏幕中的Android屏幕

Java 设备主屏幕中的Android屏幕,java,android,Java,Android,如何为android创建类似的东西 简而言之,当您单击应用程序图标时,此窗口将打开 我试图寻找,但我不知道用什么术语来找到一个基本的例子 一些建议?这是一个由服务支持的浮动视图(因为它不是应用程序主要活动流的一部分)。创建透明活动。在style.xml中创建自定义样式,如下所示 <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Lig

如何为android创建类似的东西

简而言之,当您单击应用程序图标时,此窗口将打开

我试图寻找,但我不知道用什么术语来找到一个基本的例子


一些建议?

这是一个由服务支持的浮动视图(因为它不是应用程序主要活动流的一部分)。

创建透明活动。在style.xml中创建自定义样式,如下所示

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="Theme.AppCompat.Transparent.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">true</item>
</style>

@颜色/原色
@颜色/原色暗
@颜色/颜色重音
符合事实的
@android:彩色/透明
@空的
符合事实的
符合事实的
符合事实的

并在Manifest.xml应用程序或活动部分中使用它

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Transparent.NoActionBar">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

然后,当然,您需要在活动的中心创建一个背景色的布局,并将视图放在其中


希望它有帮助

我不太确定我是否正确,所以它是一个独立的流程,一个服务,对吗?我可以寻找什么来找到一个例子呢?谢谢你,我不知道这个黑客,尽管我认为它作为一种服务做得更多。因为在我发布的图片中,如果我点击透明部分的外部,它会关闭应用程序。你认为你能做那样的事吗?P.Š。如果我想做圆角,我该怎么做?不需要做特殊的事情来处理活动透明部分的点击事件。只需监听活动上的单击事件并关闭应用程序。对于圆角,使用cardView作为容器并设置其cornerRadius值。