Activity
与ViewPager
Fragment
,这是自定义布局模板Loader
下载(使用Fragment
),下载后我正在完成之前虚增的布局。内部布局我有容器,我手动添加“行”(下载后我知道多少),布局在这里:
<?xml version="1.0" encoding="utf-8"?>
<com.custom.mobile.widgets.ForegroundLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
app:foregroundCompat="?attr/selectableItemBackground">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/poll_option_single_row_option_percent"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/black"
android:textSize="16sp"
android:singleLine="true"
android:gravity="center"
android:visibility="invisible"/>
<RadioButton
android:id="@+id/poll_option_single_row_option_radio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"/>
<TextView
android:id="@+id/poll_option_single_row_option_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/poll_option_single_row_option_percent"
android:fontFamily="sans-serif-light"
android:paddingLeft="8dp"
android:textColor="@android:color/black"
android:textSize="16sp" />
</RelativeLayout>
<ProgressBar
android:id="@+id/poll_option_single_row_option_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100"
android:visibility="invisible"/>
</com.custom.mobile.widgets.ForegroundLinearLayout>
source of ForegroundLinearLayout might be found here,可能与问题没有关系,这是很少见且独立于操作系统版本或制造商:
Fatal Exception: android.view.InflateException: Binary XML file line #44: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
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 com.custom.mobile.widgets.PollLayout$PollHolder.(Unknown Source)
at com.custom.mobile.widgets.PollLayout.printPoll(Unknown Source)
at com.custom.mobile.widgets.PollLayout.init(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.preparePoll(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.prepareArticleView(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.displayArticle(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.newInstance(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.onLoadFinished(Unknown Source)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.callOnLoadFinished(Unknown Source)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(Unknown Source)
at android.support.v4.content.Loader.deliverResult(Unknown Source)
at com.custom.mobile.integration.asyncloader.AsyncLoader.deliverResult(Unknown Source)
at android.support.v4.content.AsyncTaskLoader.dispatchOnLoadComplete(Unknown Source)
at android.support.v4.content.AsyncTaskLoader$LoadTask.onPostExecute(Unknown Source)
at android.support.v4.content.ModernAsyncTask.finish(Unknown Source)
at android.support.v4.content.ModernAsyncTask.access$400(Unknown Source)
at android.support.v4.content.ModernAsyncTask$InternalHandler.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6145)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
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 com.custom.mobile.widgets.PollLayout$PollHolder.(Unknown Source)
at com.custom.mobile.widgets.PollLayout.printPoll(Unknown Source)
at com.custom.mobile.widgets.PollLayout.init(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.preparePoll(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.prepareArticleView(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.displayArticle(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.newInstance(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.onLoadFinished(Unknown Source)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.callOnLoadFinished(Unknown Source)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(Unknown Source)
at android.support.v4.content.Loader.deliverResult(Unknown Source)
at com.custom.mobile.integration.asyncloader.AsyncLoader.deliverResult(Unknown Source)
at android.support.v4.content.AsyncTaskLoader.dispatchOnLoadComplete(Unknown Source)
at android.support.v4.content.AsyncTaskLoader$LoadTask.onPostExecute(Unknown Source)
at android.support.v4.content.ModernAsyncTask.finish(Unknown Source)
at android.support.v4.content.ModernAsyncTask.access$400(Unknown Source)
at android.support.v4.content.ModernAsyncTask$InternalHandler.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6145)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by java.lang.OutOfMemoryError: Failed to allocate a 155148 byte allocation with 129688 free bytes and 126KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:827)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:646)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1019)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:3778)
at android.content.res.Resources.loadDrawable(Resources.java:3651)
at android.content.res.Resources.getDrawable(Resources.java:1865)
at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:319)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1155)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1068)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:3767)
at android.content.res.Resources.loadDrawable(Resources.java:3651)
at android.content.res.TypedArray.getDrawable(TypedArray.java:762)
at android.widget.ProgressBar.(ProgressBar.java:357)
at android.widget.ProgressBar.(ProgressBar.java:313)
at android.widget.ProgressBar.(ProgressBar.java:309)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
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 com.custom.mobile.widgets.PollLayout$PollHolder.(Unknown Source)
at com.custom.mobile.widgets.PollLayout.printPoll(Unknown Source)
at com.custom.mobile.widgets.PollLayout.init(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.preparePoll(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.prepareArticleView(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.displayArticle(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.newInstance(Unknown Source)
at com.custom.mobile.activity.fragment.ArticleFragment.onLoadFinished(Unknown Source)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.callOnLoadFinished(Unknown Source)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(Unknown Source)
at android.support.v4.content.Loader.deliverResult(Unknown Source)
at com.custom.mobile.integration.asyncloader.AsyncLoader.deliverResult(Unknown Source)
at android.support.v4.content.AsyncTaskLoader.dispatchOnLoadComplete(Unknown Source)
at android.support.v4.content.AsyncTaskLoader$LoadTask.onPostExecute(Unknown Source)
at android.support.v4.content.ModernAsyncTask.finish(Unknown Source)
at android.support.v4.content.ModernAsyncTask.access$400(Unknown Source)
at android.support.v4.content.ModernAsyncTask$InternalHandler.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6145)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
由line:
引起li.inflate(R.layout.option_single_row_layout, root, false);
我无法弄清楚如何重新创建错误条件... <ProgressBar
上的XML行号。我已经对此布局进行了一些更改,并且在发布后更改了行号,仍指向<ProgressBar
...帮助,请...:/
答案 0 :(得分:0)
查看你的一个xml ..可能是你在xml中为自定义布局提供了错误的路径