Error[8]: Undefined offset: 7, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述在使用LayoutInflater对Fragment中的布局进行膨胀时,我收到此异常:.es/layout/locations_list.xmlline#-1(sorry,notyetimplemented):Errorinflatingclasscom.costum.android.widget.LoadMoreListView我发现在充气自定义布局时会发生这种情况@Overridepubli

在使用LayoutInflater对Fragment中的布局进行膨胀时,我收到此异常:

 ./res/layout/locations_List.xml line #-1 (sorry, not yet implemented): Error inflating class com.costum.androID.Widget.LoadMoreListVIEw

我发现在充气自定义布局时会发生这种情况

@OverrIDe    public VIEw onCreateVIEw(LayoutInflater inflater, VIEwGroup container,            Bundle savedInstanceState) {        return inflater.inflate(R.layout.locations_List, container, false);    }

编辑这是locations_List.xml:

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:background="@androID:color/white"    androID:orIEntation="vertical" >    <com.costum.androID.Widget.LoadMoreListVIEw        androID:ID="@+ID/androID:List"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:padding="0dp" /></linearLayout>

任何其他布局充气机工作,如在此测试中:

@Test    public voID testInflator() {        ActivityController<SherlockFragmentActivity> activityController = CustomTestRunner                .startActivity();        SherlockFragmentActivity activity = activityController.get();        LayoutInflater from = LayoutInflater.from(activity);        VIEw vIEw = from                .inflate(com.twisper.R.layout.locations_List_item, null);        assertNotNull(vIEw);    }

我正在使用带有2.2-SNAPSHOT的Robolectric,现在我的问题是如何解决这个问题或者如何实现缺少的功能,robolectric文档非常稀疏,因此我很难找到任何起点.

全栈跟踪

androID.vIEw.InflateException: XML file ./res/layout/locations_List.xml line #-1 (sorry, not yet implemented): Error inflating class com.costum.androID.Widget.LoadMoreListVIEw    at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:613)    at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:687)    at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java:746)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:489)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:396)...Caused by: java.lang.reflect.InvocationTargetException    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_createVIEw(LayoutInflater.java:587)    at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_createVIEwFromTag(LayoutInflater.java:687)    at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746)    at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java)...Caused by: java.lang.Stringindexoutofboundsexception: String index out of range: -9    at java.lang.String.substring(String.java:1911)    at org.robolectric.res.Resname.qualifyResname(Resname.java:50)    at org.robolectric.res.Attribute.getResourceReference(Attribute.java:138)    at org.robolectric.res.Attribute.qualifIEdValue(Attribute.java:127)    at org.robolectric.res.builder.XmlfileBuilder$XmlResourceParserImpl.qualify(XmlfileBuilder.java:316)    at org.robolectric.res.builder.XmlfileBuilder$XmlResourceParserImpl.getAttributeValue(XmlfileBuilder.java:340)    at org.robolectric.shadows.ShadowResources.findAttributeValue(ShadowResources.java:252)    at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:188)    at org.robolectric.shadows.ShadowResources.access androID:ID="@+ID/androID:List"0(ShadowResources.java:51)    at org.robolectric.shadows.ShadowResources$Shadowtheme.obtainStyledAttributes(ShadowResources.java:460)

我还在robolectrics问题跟踪器上发布了issue.

解决方法:

我想通了,如果你有这种情况,只需在XML中查找你的ID,即使这样

 androID:ID="@androID:ID/List"

在一些示例代码中经常可以看到它必须是:

[+++]
总结

以上是内存溢出为你收集整理的android – 自定义布局通货膨胀与Robolectric中的碎片无法正常工作全部内容,希望文章能够帮你解决android – 自定义布局通货膨胀与Robolectric中的碎片无法正常工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
android– 自定义布局通货膨胀与Robolectric中的碎片无法正常工作_app_内存溢出

android– 自定义布局通货膨胀与Robolectric中的碎片无法正常工作

android– 自定义布局通货膨胀与Robolectric中的碎片无法正常工作,第1张

概述在使用LayoutInflater对Fragment中的布局进行膨胀时,我收到此异常:.es/layout/locations_list.xmlline#-1(sorry,notyetimplemented):Errorinflatingclasscom.costum.android.widget.LoadMoreListView我发现在充气自定义布局时会发生这种情况@Overridepubli

在使用LayoutInflater对Fragment中的布局进行膨胀时,我收到此异常:

 ./res/layout/locations_List.xml line #-1 (sorry, not yet implemented): Error inflating class com.costum.androID.Widget.LoadMoreListVIEw

我发现在充气自定义布局时会发生这种情况

@OverrIDe    public VIEw onCreateVIEw(LayoutInflater inflater, VIEwGroup container,            Bundle savedInstanceState) {        return inflater.inflate(R.layout.locations_List, container, false);    }

编辑这是locations_List.xml:

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:background="@androID:color/white"    androID:orIEntation="vertical" >    <com.costum.androID.Widget.LoadMoreListVIEw        androID:ID="@+ID/androID:List"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:padding="0dp" /></linearLayout>

任何其他布局充气机工作,如在此测试中:

@Test    public voID testInflator() {        ActivityController<SherlockFragmentActivity> activityController = CustomTestRunner                .startActivity();        SherlockFragmentActivity activity = activityController.get();        LayoutInflater from = LayoutInflater.from(activity);        VIEw vIEw = from                .inflate(com.twisper.R.layout.locations_List_item, null);        assertNotNull(vIEw);    }

我正在使用带有2.2-SNAPSHOT的Robolectric,现在我的问题是如何解决这个问题或者如何实现缺少的功能,robolectric文档非常稀疏,因此我很难找到任何起点.

全栈跟踪

androID.vIEw.InflateException: XML file ./res/layout/locations_List.xml line #-1 (sorry, not yet implemented): Error inflating class com.costum.androID.Widget.LoadMoreListVIEw    at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:613)    at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:687)    at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java:746)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:489)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:396)...Caused by: java.lang.reflect.InvocationTargetException    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_createVIEw(LayoutInflater.java:587)    at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_createVIEwFromTag(LayoutInflater.java:687)    at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746)    at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java)    at androID.vIEw.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396)    at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java)...Caused by: java.lang.Stringindexoutofboundsexception: String index out of range: -9    at java.lang.String.substring(String.java:1911)    at org.robolectric.res.Resname.qualifyResname(Resname.java:50)    at org.robolectric.res.Attribute.getResourceReference(Attribute.java:138)    at org.robolectric.res.Attribute.qualifIEdValue(Attribute.java:127)    at org.robolectric.res.builder.XmlfileBuilder$XmlResourceParserImpl.qualify(XmlfileBuilder.java:316)    at org.robolectric.res.builder.XmlfileBuilder$XmlResourceParserImpl.getAttributeValue(XmlfileBuilder.java:340)    at org.robolectric.shadows.ShadowResources.findAttributeValue(ShadowResources.java:252)    at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:188)    at org.robolectric.shadows.ShadowResources.access androID:ID="@+ID/androID:List"0(ShadowResources.java:51)    at org.robolectric.shadows.ShadowResources$Shadowtheme.obtainStyledAttributes(ShadowResources.java:460)

我还在robolectrics问题跟踪器上发布了issue.

解决方法:

我想通了,如果你有这种情况,只需在XML中查找你的ID,即使这样

 androID:ID="@androID:ID/List"

在一些示例代码中经常可以看到它必须是:

          总结       

以上是内存溢出为你收集整理的android – 自定义布局通货膨胀与Robolectric中的碎片无法正常工作全部内容,希望文章能够帮你解决android – 自定义布局通货膨胀与Robolectric中的碎片无法正常工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1096623.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存