FlutterAds / flutter_qq_ads

🔥🔥🔥 Flutter 广告插件 -- 优量汇 、广点通、腾讯广告(支持开屏、插屏、激励视频、Banner、信息流、视频贴片)
https://pub.dev/packages/flutter_qq_ads
MIT License
107 stars 17 forks source link

android获取到的广告宽高非常小 #27

Closed dreamstartLZ closed 1 year ago

dreamstartLZ commented 1 year ago

不知道是什么原因导致 android获取到的广告宽高非常小 我只能暂时这样修改使用

/**
 * 重新计算真实的广告 View 的宽高
 */
private void resizeAdView() {
    this.fad.measure(100, 100);
    int mw = this.fad.getMeasuredWidth();
    int mh = this.fad.getMeasuredHeight();

    //修改
    mw = activity.getResources().getDisplayMetrics().widthPixels;
    mh = (mw / 4) * 3;

    Log.d(TAG, "resizeAdView width:" + mw + " height:" + mh);
    FrameLayout.LayoutParams params=new FrameLayout.LayoutParams(mw,mh);
    frameLayout.setLayoutParams(params);
    frameLayout.requestLayout();
    setFlutterViewSize(mw,mh);
}
BytesZero commented 1 year ago

你这个是固定 4:3 的,我是 SDK 所以需要适配所有的情况

BytesZero commented 1 year ago

后续会将高度自动去掉,改为固定高度的广告,使用者自行设定固定宽高

BytesZero commented 1 year ago

已更新 v2.6.0