点击图标进入指定浏览器 点击图标进入指定浏览器将首页设置全透明解决一闪而过问题

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

点击图标进入指定浏览器 点击图标进入指定浏览器将首页设置全透明解决一闪而过问题

  2021-03-19 我要评论
想了解点击图标进入指定浏览器将首页设置全透明解决一闪而过问题的相关内容吗,在本文为您仔细讲解点击图标进入指定浏览器的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:图标,浏览器,透明,下面大家一起来学习吧。

点击图标进入指定浏览器。

只需在onCreate()方法里添加如下代码:

String url = "http://tiger-kfphone.com/"; 
Uri u = Uri.parse(url); 
Intent intent = new Intent(Intent.ACTION_VIEW, u); 
// intent.setData(u); 
// intent.setClassName("com.android.browser", 
// "com.android.browser.BrowserActivity"); 
startActivity(intent); 
finish();

但是在进入浏览器之前有一个页面闪了一下,那是因为从那个空白的首页跳过去的。客户说不要那个一闪而过的页面,说是个bug。

最后解决的办法是把他变成透明的就好了。

在styles.xml里添加如下代码:

<style name="Translucent_NoTitle" parent="android:style/Theme.Dialog"> 
<item name="android:windowNoTitle">true</item> 
<item name="android:background">#00000000</item> 
<item name="android:windowBackground">@android:color/transparent</item> 
<item name="android:colorBackgroundCacheHint">@null</item> 
<item name="android:windowIsTranslucent">true</item> 
</style>

然后在AndroidManifest里添加如下代码:

<activity 
android:name="com.hklt.link.MainActivity" 
android:label="@string/app_name" 
android:theme="@style/Translucent_NoTitle" > 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
</activity>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们