Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
工具栏:com.android.layoutlib.bridge.MockView无法强制转换为android.view.ViewGroup_Android_Android Actionbar_Android Toolbar - Fatal编程技术网

工具栏:com.android.layoutlib.bridge.MockView无法强制转换为android.view.ViewGroup

工具栏:com.android.layoutlib.bridge.MockView无法强制转换为android.view.ViewGroup,android,android-actionbar,android-toolbar,Android,Android Actionbar,Android Toolbar,嗨,我正在使用工具栏来替换Actionbar 我尝试使用我的.xml文件 在这个文件中,我尝试使用工具栏作为根布局。 我包括support-v7-appcompat库 <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:lay

嗨,我正在使用工具栏来替换Actionbar

我尝试使用我的.xml文件

在这个文件中,我尝试使用工具栏作为根布局。 我包括support-v7-appcompat库

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar     
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout 
    android:id="@+id/music_actionbar_display_home"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:layout_marginRight="2dp"
    android:weightSum="2" >

    <ImageView 
        android:id="@+id/music_actionbar_backbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/home_back"           
        android:layout_weight="1"
        android:layout_marginRight="2dp"
        android:layout_gravity="center" />

    <ImageView 
        android:id="@+id/music_actionbar_logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/home_square_logo"
        android:layout_weight="1"
        android:layout_gravity="center" />

</LinearLayout>

<Spinner
    android:id="@+id/music_actionbar_language"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" 
    android:drawSelectorOnTop="true"
    android:layout_marginLeft="5dp"
    android:layout_toRightOf="@+id/music_actionbar_display_home"
    android:spinnerMode="dialog" />

</android.support.v7.widget.Toolbar>

我做错了什么?

当您尝试运行应用程序时会引发此异常?你能把完整的stacktrace放进去吗?@Shyish这是渲染异常。呈现过程中引发异常:com.android.layoutlib.bridge.MockView无法强制转换为android.view.viewgroup有时布局编辑器工作不正常,能否尝试运行应用程序以查看发生的情况?@Shyish确定。我会查一查,然后告诉你
Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup