Android微信支付成功或取消支付之后,返回的页面会出现闪动问题

支付页面(WXPayEntryActivity页面的支付回调)

   @Override
    public void onResp(BaseResp baseResp) {

//        Logger.e("WXPayEntryActivity回调微信支付的结果errCode = " + resp.errCode);
        Log.e("yaya", "WXPayEntryActivity回调微信支付的结果errCode=" + baseResp.errCode);
        if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
            int errCode = baseResp.errCode;
            if (errCode == -1) {/*支付失败*/
                Toast.makeText(this, "支付失败", Toast.LENGTH_LONG).show();
                overridePendingTransition(0,0);
            } else if (errCode == 0) {/*支付成功*/
                Toast.makeText(this, "支付成功", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(WXPayEntryActivity.this, MyOrderActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("types", "1");
                bundle.putString("state", "支付");
                intent.putExtras(bundle);
                startActivity(intent);
                finish();
                overridePendingTransition(0,0);
            } else if (errCode == -2) {/*取消支付*/
                Toast.makeText(this, "取消支付", Toast.LENGTH_LONG).show();
                overridePendingTransition(0,0);
            }
            finish();

        }

    }

AndroidManifest.xml配置

   
        <activity
            android:name=".wxapi.WXPayEntryActivity"
            android:exported="true"
            android:theme="@style/wx_theme"
            android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="wxc898d6798fa6049b" />
            intent-filter>
        activity>
```xml
styles

    <style name="wx_theme" parent="AppTheme">
        
        
        "android:windowBackground">@color/translucent
        "android:windowIsTranslucent">true

    style>

你可能感兴趣的:(Android微信支付成功或取消支付之后,返回的页面会出现闪动问题)