膨胀类android.support.design.widgetCollapsingToolbarLayout时出错



我正试图让我的布局工作起来,实现支持设计库功能。然而,当我尝试运行项目时,当我的布局被加载时,我会遇到以下异常。

Android.Views.充气异常:二进制XML文件行#2:错误正在膨胀类android.support.design.widgetCollapsingToolbarLayout

这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
  <!-- As the main content view, the view below consumes the entire
         space available using match_parent in both dimensions. -->
  <RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/main_grey">
    <android.support.design.widget.CoordinatorLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true">
      <android.support.design.widget.AppBarLayout
          android:layout_height="192dp"
          android:layout_width="match_parent">
        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll"
          >
          <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:minHeight="60dp"
            android:background="@drawable/actionbar_background">
            <ImageView
                android:id="@+id/psonar_logo"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_gravity="top|center_horizontal"
                android:visibility="gone" />
            <RelativeLayout
                android:id="@+id/toolbarTitles"
                android:layout_alignParentLeft="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone">
              <TextView
                  android:id="@+id/toolbarTitle"
                  android:ellipsize="end"
                  android:maxLines="1"
                  android:textSize="18dp"
                  android:textColor="@color/white"
                  android:layout_alignParentLeft="true"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content" />
              <TextView
                  android:id="@+id/toolbarSubtitle"
                  android:ellipsize="end"
                  android:maxLines="1"
                  android:textColor="@color/white"
                  android:gravity="center_vertical"
                  android:visibility="gone"
                  android:layout_alignParentLeft="true"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/toolbarTitle" />
            </RelativeLayout>
          </android.support.v7.widget.Toolbar>
        </android.support.design.widget.CollapsingToolbarLayout>
      </android.support.design.widget.AppBarLayout>
      <android.support.v4.widget.NestedScrollView
          android:id="@+id/scroll"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:clipToPadding="false"
          app:layout_behavior="@string/appbar_scrolling_view_behavior">
        <FrameLayout
          android:minWidth="25px"
          android:minHeight="25px"
          android:layout_width="match_parent"
          android:layout_height="175dp"
          android:id="@+id/carouselFrameLayout" />
      </android.support.v4.widget.NestedScrollView>
    </android.support.design.widget.CoordinatorLayout>
    <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/toolbar"
      android:layout_above="@id/miniPlayerHolder"
      android:background="@color/main_grey"
      android:animateLayoutChanges="true"
      android:orientation="vertical">
      <TabHost
          android:id="@android:id/tabhost"
          android:layout_width="match_parent"
          android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
          <TabWidget
              android:id="@android:id/tabs"
              android:layout_width="match_parent"
              android:layout_height="45dp"
              android:tabStripEnabled="false"
              android:layout_weight="0"
              android:showDividers="none" />
          <FrameLayout
              android:id="@android:id/tabcontent"
              android:layout_width="0dp"
              android:layout_height="0dp"
              android:layout_weight="0" />
          <android.support.v4.view.ViewPager
              android:id="@+id/pager"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1" />
        </LinearLayout>
      </TabHost>
    </LinearLayout>
    <include
      layout="@layout/mini_player_holder" />
  </RelativeLayout>
  <!-- android:layout_gravity="start" tells DrawerLayout to treat
         this as a sliding drawer on the left side for left-to-right
         languages and on the right side for right-to-left languages.
         The drawer is given a fixed width in dp and extends the full height of
         the container. A solid background is used for contrast
         with the content view. -->
  <include
      layout="@layout/home_drawer_menu" />
</android.support.v4.widget.DrawerLayout>

我尝试构建一个简单的测试项目,该项目实现了CollapsingToolbarLayout,它工作起来没有任何问题,但一旦我尝试将其放入我的项目中,它就停止了工作。

我检查了nuget软件包,它们似乎安装得很好。我们的主题继承自:theme.AppCompat.NoActionBar.

Stacktrace:

{Android.Views.充气异常:类型的异常引发了"Android.Views.充气异常"。在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x000b]在/Users/builder/data/lanes/2185/53fce373/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61在Android.Runtime.JNIEnv.CallNonvirtualVoidMethod(intptr,int ptr,intptr、Android.Runtime.JValue*)中的[0x0084]/Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029位于中的Android.App.Activity.SetContentView(int)[0x0070]/Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/platforms/Android-23/src/onerated/Android.App.Activity.cs:5872在Psonar.Apps.Droid.PayPerPlay.HomeActivity.On创建(Android.OS.Bundle)中的[0x0009]E: \Dev\psonar\Source\psonar.Apps\psonar.Apps.Droid\psonar.Apps.Droid.PayPerPlay\UI\HomeActivity.cs:66在Android.Support.V4.App.FragmentActivity.n._OnCreate_Landroid_os_Bundle_在(包装器)动态方法)对象14ce2242-a35-41bb-a13-286527a98d77(intptr、intptr和intptr)

---托管异常堆栈跟踪结束---android.view.InflateException:二进制XML文件第2行:错误膨胀类android.support.design.widgetCollapsingToolbarLayout在android.view.LayoutInflater.createView(LayoutInflater.java:633)在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)在android.view.LayoutInflater.rInflate(LayoutInflater.java:806)android.view.LayoutInflater.rInflate(LayoutInflater.java:809)位于android.view.LayoutInflater.rInflate(LayoutInflater.java:809)位于android.view.LayoutInflater.rInflate(LayoutInflater.java:809)位于android.view.LayoutInflater.inflature(LayoutInflater.java:504)android.view.LayoutInflater.inflature(LayoutInflater.java:414)android.view.LayoutInflater.inflature(LayoutInflater.java:365)android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDeleateImplV7.java:255)在android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)位于md5cdb4fd1f07f997be815955fad4c2fb.HomeActivity.n_onCreate(本机方法)md5cdb4fd1f07f997be815955fad4cc2feb.HomeActivity.onCreate(HomeActivity.java:38)在android.app.Activity.performCreate(Activity.java:5990)android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)在android.app.ActivityThread.performLaunchActivity(ActivityThreads.java:2278)在android.app.ActivityThread.handleLaunchActivity(ActivityThreads.java:2387)在android.app.ActivityThread.access$800(ActivityThreads.java:151)android.app.ActivityThread$H.handleMessage(ActivityThreads.java:1303)在android.os.Handler.dispatchMessage(Handler.java:102)android.os.Looper.loop(Looper.java:135)android.app.ActivityThread.main(ActivityThreads.java:5254)位于的java.lang.reflect.Method.ioke(本机方法)位于的java.lang.reflect.Method.ioke(Method.java:372)com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)网址:com.android.internal.os.ZygoteInit.main(ZygoteNit.java:698)由处的java.lang.reflect.InvocationTargetException引起位于的java.lang.reflect.Constructure.newInstance(本机方法)java.lang.reflect.Constructure.newInstance(Constructor.java:288)位于android.view.LayoutInflater.createView(LayoutInflater.java:607)。。。还有25个原因:java.lang.NoSuchFieldError:没有静态字段类中类型I的TextAppearance_android_shadowColorLandroid/support/design/R$样式;或其超类(声明的"android.support.design.R$styleable"出现在/data/app/com.psonar.android-1/base.apk)android.support.design.widget。CollapsingTextHelper.setExpandedTextAppearance(CollapsingTextHelper.java:230)在android.support.design.widget.CollapsingToolbarLayout.(CollapsingToolbarLayout.java:185)在android.support.design.widget.CollapsingToolbarLayout.(CollapsingToolbarLayout.java:126)…28更多}

我希望解决方案是其他的,但简单地重新安装支持设计库包就成功了。我不得不通过Xamarin Studio来做这件事,尽管Visual Studio在这种情况下行为不端。

相关内容

  • 没有找到相关文章

最新更新