Laya项目发布安卓apk包,穿山甲Banner广告位置设置问题


项目发布成安卓包后,由于Laya对Activity包了一层 game_plugin_get_view,导致穿山甲Banner广告位置无法贴底问题的解决方案,由于困扰较久特此记录,

1.新建一个activity_main.xml文件

2.在MainActivity的initEngin中重新设置ContentView

具体代码如下

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="HardcodedText"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!-- BannerView的Container -->
    <FrameLayout
        android:id="@+id/game_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="#D5D5D5" />
    <FrameLayout
        android:id="@+id/banner_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="#D5D5D5"
        android:layout_alignParentBottom="true"/>

</RelativeLayout>
public void initEngine()
    {
        mProxy = new RuntimeProxy(this);
        mPlugin = new GameEngine(this);
        mPlugin.game_plugin_set_runtime_proxy(mProxy);
        mPlugin.game_plugin_set_option("localize","false");
        mPlugin.game_plugin_set_option("gameUrl", App_Startup_Entry);
        mPlugin.game_plugin_init(3);
        View gameView = mPlugin.game_plugin_get_view();
        this.setContentView(R.layout.activity_main);
        this.gameContainer = findViewById(R.id.game_container);
        this.banner_container = findViewById(R.id.banner_container);
        this.gameContainer.addView(gameView);
        isLoad=true;
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM