1

伙计们!我遇到了一个问题。我正在使用支持首选项倾斜库来显示设置。

在某些情况下,我还需要在移动设备上显示后仰设置,并且在Lollipop 之前的设备上,片段在使用此堆栈跟踪时因膨胀而崩溃

E/AndroidRuntime: FATAL EXCEPTION: main
              android.view.InflateException: Binary XML file line #25: Error inflating class <unknown>
                  at android.view.LayoutInflater.createView(LayoutInflater.java:613)
                  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                  at android.support.v7.preference.PreferenceGroupAdapter.onCreateViewHolder(PreferenceGroupAdapter.java:280)
                  at android.support.v7.preference.PreferenceGroupAdapter.onCreateViewHolder(PreferenceGroupAdapter.java:35)
                  at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5482)
                  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4707)
                  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617)
                  at android.support.v17.leanback.widget.GridLayoutManager.getViewForPosition(GridLayoutManager.java:998)
                  at android.support.v17.leanback.widget.GridLayoutManager$3.createItem(GridLayoutManager.java:1485)
                  at android.support.v17.leanback.widget.SingleRow.appendVisibleItems(SingleRow.java:111)
                  at android.support.v17.leanback.widget.Grid.appendOneColumnVisibleItems(Grid.java:364)
                  at android.support.v17.leanback.widget.GridLayoutManager.appendOneColumnVisibleItems(GridLayoutManager.java:1721)
                  at android.support.v17.leanback.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:1904)
                  at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3028)
                  at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2906)
                  at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
                  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
                  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
                  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
                  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1021)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
                  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
                  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                  at android.view.View.layout(View.java:14008)
                  at android.view.ViewGroup.layout(ViewGroup.java:4373)
                  at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1892)
                at android.view.Vie

没有人知道,“在 android.view.Vie”之后会发生什么,但我已经本地化了问题,那是因为移动设备找不到PreferenceCategory类/布局。如果我从preferences.xml 文件中删除PreferenceCategories - 一切正常。

还添加了支持首选项库,但这并没有解决问题。

你有什么想法,为什么会发生这种情况?

PS:如果您需要更多信息 - 我会添加更多来源并回答所有问题。

非常感谢!

4

0 回答 0