EffectiveAndroidUI icon indicating copy to clipboard operation
EffectiveAndroidUI copied to clipboard

fixed inflate exception occured in ChapterRenderer.java

Open wanyt opened this issue 9 years ago • 0 comments

The pull request fixes the exception:

android.view.InflateException: Binary XML file line #32: Error inflating class <unknown>
                                                                                            at android.view.LayoutInflater.createView(LayoutInflater.java:620)
                                                                                            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                                                                                            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
                                                                                            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
                                                                                            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
                                                                                            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                                                            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                                                                                            at com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterRenderer.inflate(ChapterRenderer.java:64)

And the exception still occurs when I tested it in the Samsung GT-I8552. Although I fixed it, I don't know why. The exception occurred in ChapterRenderer.java:

@Override protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) {
    return layoutInflater.inflate(R.layout.row_chapter, viewGroup, false);
  }

I thought maybe row_chapter.xml causes the crash, and I created a file named row_chapter_2.xml. Then, I put the attribute copy from styles-chapter.xml to row_chapter_2.xml. like below:

<TextView android:id="@+id/tv_chapter_number"
      android:layout_alignParentLeft="true"
      android:layout_centerVertical="true"
      style="@style/AppTheme.Chapter.Number"/>

replaced by

<TextView android:id="@+id/tv_chapter_number"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/sixth_color"
        android:textSize="@dimen/numeric_title_size"
        android:layout_marginLeft="@dimen/secondary_margin"/>

And the crash is solved. Do you know the reason?

wanyt avatar Aug 29 '16 09:08 wanyt