应用窗口化
1. 思路
1. 通过主题把整个应用窗口化
2. 通过WindowManager实现悬浮窗方式
2. 实现:
方式一:
<style name="Theme.DialogActivity" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowBackground">@drawable/shape_act_dialog</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<corners android:radius="5dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhu.demotest">
<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.DialogActivity">
<activity android:name=".MainActivity"
android:theme="@style/Theme.DialogActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
方式二:
|