Click the icon to enter the specified browser to set the home page transparent to solve the problem of flash
- 2020-06-07 05:16:51
- OfStack
Click the icon to enter the specified browser.
Just add the following code to the onCreate() method:
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();
But a page flashes 1 times before entering the browser because it jumps across the blank front page. The client said no to the 1 flash page and said it was an bug.
The final solution is to make it transparent.
Add the following code to 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>
Then add the following code to 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>