我在我的应用程序中使用 DrawerNavigator。我创建了一个与 android 4.2 完美配合的 android 应用程序,但是当我尝试在 android 2.2 中启动它时出现此错误:
android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
at android.widget.AbsListView.obtainView(AbsListView.java:1582)
at android.widget.ListView.makeAndAddView(ListView.java:1801)
at android.widget.ListView.fillDown(ListView.java:724)
at android.widget.ListView.fillFromTop(ListView.java:781)
at android.widget.ListView.layoutChildren(ListView.java:1638)
at android.widget.AbsListView.onLayout(AbsListView.java:1412)
at android.view.View.layout(View.java:7175)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:672)
at android.view.View.layout(View.java:7175)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7175)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
at android.view.View.layout(View.java:7175)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7175)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7175)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1146)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1866)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
编辑:这些行也在那里:
07-22 16:00:52.111: E/AndroidRuntime(470): Caused by: android.content.res.Resources$NotFoundException: File res/color/abs__primary_text_holo_light.xml from xml type drawable resource ID #0x0
07-22 16:00:52.111: E/AndroidRuntime(470): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1924)
07-22 16:00:52.111: E/AndroidRuntime(470): at android.content.res.Resources.loadDrawable(Resources.java:1692)
07-22 16:00:52.111: E/AndroidRuntime(470): ... 42 more
我不知道为什么。我打电话给我的fragment
( ShelrockFragment
) 从MainActivity
:
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content_frame, newsMasterFragment, "MasterFragment");
bundle.putBoolean("onFirstRow", true);
newsMasterFragment.setArguments(bundle);
膨胀视图时它会崩溃:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_news_master,
container, false);