我有问题让我的应用程序在Android 5.x.x的三星设备上运行。在使用Android 6的三星设备上一切都很好。我的问题是应用程序正在启动,但在登录屏幕后,我得到一个错误,让类ImageView:
膨胀android.view.InflateException: Binary XML file line #13: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:770)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at org.skilltrade.skilltrade_android.events.fragments.EventsListFragment.onCreateView(EventsListFragment.java:96)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1632)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1237)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1085)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1611)
at android.view.View.measure(View.java:18596)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5827)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:671)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:90)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1319)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:736)
at android.view.View.measure(View.java:18596)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5827)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:18596)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5827)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:721)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:612)
at android.view.View.measure(View.java:18596)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5827)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at android.view.View.measure(View.java:18596)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5827)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:721)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:612)
at android.view.View.measure(View.java:18596)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5827)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2897)
at android.view.View.measure(View.java:18596)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2248)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1306)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1548)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.ha
应用程序在模拟器和我的Nexus 5设备上正常运行。它只在三星设备上崩溃......我不知道问题出在哪里......第13行的ImageView是标准组件,没有任何额外的东西。
这是我的布局xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/relative_event"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/White">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/tutorial_photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tutorial_text"
android:layout_marginTop="100dp"
android:src="@drawable/vector_drawable_ic_event_black___px"
android:tint="@color/skilltrade_grey" />
<TextView
android:id="@+id/tutorial_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="@string/add_new_event"
android:textColor="@color/skilltrade_grey"
android:textSize="35dp" />
<com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srl_direction="both"
android:nestedScrollingEnabled="false">
<android.support.v7.widget.RecyclerView
android:id="@+id/events_card_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false">
</android.support.v7.widget.RecyclerView>
</com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout>
</RelativeLayout>
感谢您的帮助!
答案 0 :(得分:0)
您是否尝试使用其他图像src进行测试? bcs我认为问题在于你的图像src,如果成功则尝试使用较低的图像src然后将你想要的图像替换为较低的比例或使用jpeg。
答案 1 :(得分:0)
最后我找到了解决方案!
你必须使用app:srcCompat =“”用于矢量drawables而不是android:src =“”。它在Samusng设备上引起了问题......现在一切正常。