【问题标题】:Geckoview Doesn't work壁虎视图不起作用
【发布时间】:2018-04-14 23:01:28
【问题描述】:

我正在使用 android studio 中的 geckoview 开发一个项目。当我到达包含的活动时,该应用程序不断崩溃。使用 log cat 我发现它给了我以下错误

    FATAL EXCEPTION: main

    Process: app, PID: 2815

  java.lang.RuntimeException: Unable to start activity ComponentInfo{project name}: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class org.mozilla.gecko.GeckoView

我不知道如何解决这个问题,也不知道这是什么意思,也不知道该怎么做...... 这是我的代码,希望对你有帮助

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_page);
        Button Nav=(Button) findViewById(R.id.Nav);


        GeckoView geckoView = (GeckoView) findViewById(R.id.geckoview);


        GeckoSession session = new GeckoSession();
        geckoView.setSession(session);


        session.loadUri("http://google.com");


    }

XML

<org.mozilla.gecko.GeckoView
    android:id="@+id/geckoview"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_alignParentEnd="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginBottom="82dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/guideline2" />

提前谢谢你..

【问题讨论】:

    标签: android-studio gecko


    【解决方案1】:

    在 xml 中更改 Geckoview 如下

    <org.mozilla.geckoview.GeckoView
        android:id="@+id/geckoview"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="82dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/guideline2" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-19
      • 1970-01-01
      • 2016-06-15
      • 2020-01-27
      • 2022-01-15
      • 1970-01-01
      相关资源
      最近更新 更多