欢迎来到代码驿站!

Android代码

当前位置:首页 > 移动开发 > Android代码

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

时间:2021-05-30 08:47:13|栏目:Android代码|点击:

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

只需在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>

上一篇:Android自定义View多种效果解析

栏    目:Android代码

下一篇:Android编程中读写私有文件的方法

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

本文地址:http://www.codeinn.net/misctech/132063.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有