@24jieqi/react-native-brayant-ad 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,11 +40,13 @@ public class BannerAdView extends RelativeLayout {
|
|
|
40
40
|
super(context);
|
|
41
41
|
mContext = context.getCurrentActivity();
|
|
42
42
|
reactContext = context;
|
|
43
|
-
// 开始展开
|
|
44
43
|
inflate(context, R.layout.feed_view, this);
|
|
45
|
-
|
|
46
|
-
// 这个函数很关键,不然不能触发再次渲染,让 view 在 RN 里渲染成功!!
|
|
47
44
|
Utils.setupLayoutHack(this);
|
|
45
|
+
|
|
46
|
+
setLayoutParams(new RelativeLayout.LayoutParams(
|
|
47
|
+
RelativeLayout.LayoutParams.MATCH_PARENT,
|
|
48
|
+
RelativeLayout.LayoutParams.WRAP_CONTENT
|
|
49
|
+
));
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
public void setWidth(int width) {
|
|
@@ -184,11 +186,14 @@ public class BannerAdView extends RelativeLayout {
|
|
|
184
186
|
@Override
|
|
185
187
|
public void onRenderSuccess(View view, float width, float height) {
|
|
186
188
|
Log.d(TAG, "Banner onRenderSuccess: " + width + ", " + height);
|
|
187
|
-
// 在渲染成功回调时展示广告
|
|
188
189
|
RelativeLayout mExpressContainer = findViewById(R.id.feed_container);
|
|
189
190
|
if (mExpressContainer != null) {
|
|
190
191
|
mExpressContainer.removeAllViews();
|
|
191
|
-
|
|
192
|
+
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
|
193
|
+
RelativeLayout.LayoutParams.MATCH_PARENT,
|
|
194
|
+
RelativeLayout.LayoutParams.WRAP_CONTENT
|
|
195
|
+
);
|
|
196
|
+
mExpressContainer.addView(view, params);
|
|
192
197
|
}
|
|
193
198
|
onAdRenderSuccess((int) width, (int) height);
|
|
194
199
|
}
|