背景:今天和同事联调问题,提了一个这个的bug.在IPTV(IPTV apk)播放流界面,(接收来电 apk)接收到来电时弹出了windowManager对话框,但是后台的流并没有停止。
原因分析:因为弹出windowManager对话框后,后面的IPTV apk并没有挂起,导致流一直在播放。
解决方案:在接收来电 apk里面添加一个透明并且没有标题的Activity,通过Activity弹出对话框,让IPTV apk挂起停流。
这里涉及到一个比较容易忽略的问题,Activity主题设置,平时解决问题经常用到的一种方案。
系统自带主题:
android:Theme 根主题
android:Theme.Black 背景黑色
android:Theme.Light 背景白色
android:Theme.Wallpaper 以桌面墙纸为背景
android:Theme.Translucent 透明背景
android:Theme.Panel 平板风格
android:Theme.Dialog 对话框风格
android:Theme.Holo Holo根主题
android:Theme.Holo.Black Holo黑主题
android:Theme.Holo.Light Holo白主题等等。。。
如:
<activity android:name="net.sunniwell.voip.client.activity.DialActivity"
android:theme="@style/Transparent">
<intent-filter>
<action android:name="net.sunniwell.DialActivity"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<style name="Transparent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/voip_hangup_incomingcall_transparent</item>
</style>