Native advertising is based on the user's own business layout and functions to build the layout, and then fill and display the advertising content in accordance with the native advertising rules so that the advertising and application style and elements can be adapted to achieve a seamless effect.
The current guide function shows how to use native ad controls and the rules and usage of related supporting templates.
In the user layout, add a native advertising view and internal display controls, and the current components use basic TextView, ImageView and Video controls.
app: united -current ad slot id, which is currently configured for native ad slots, users can fill in the XML page or set it after the interface controls are initialized, refer to the following.
If the ad slot configuration is not completed in the XML or code, it will cause the ad to fail to load and affect the display effect of the ad
Full example
publicclassUserAInsertctivityextendsAppCompatActivity {TextView textView;ImageView imageView;Adx3UserView view_user;Adx3VideoView video_user; @OverrideprotectedvoidonCreate(@NullableBundle savedInstanceState) { super.onCreate(savedInstanceState);setContentView(R.layout.xml);initView();setUserView(); }privatevoidinitView() { textView =findViewById(R.id.textView); imageView =findViewById(R.id.imageView); view_user =findViewById(R.id.view_user); video_user =findViewById(R.id.video_user); }privatevoidsetUserView() {//if you don't set the UnitId in XML //view_user.setUnitId("UnitId");view_user.setImageView(imageView);view_user.setVideoView(video_user);view_user.setTextView(textView);view_user.load(); }}
Ok, so far, the native ad has been added. After executing the load ad loading method, the ad will be automatically filled into the control, so that the control can adapt to the theme and style of the application.
Remark
Currently, native ads only support three elements: text, image, and video by default.