我有一个包含String Format的Layout.xml的字符串输入。
// String that contains the Layout.xml :
String concat ;
// Create the XmlPullParser from the String format
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput( new StringReader (concat) );
// create le The LayoutInflater
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View myView = inflater.inflate(xpp, null);
我遇到了这个bug:
请帮忙解决一下?03-12 08:23:12.876: W/System.err(937): android.view.InflateException: START_TAG http://schemas.android.com/apk/res/android}android:orientation='vertical' {http://schemas.android.com/apk/res/android}android:layout_width='fill_parent' {http://schemas.android.com/apk/res/android}android:layout_height='fill_parent'>@1:226 in java.io.StringReader@44f50508: Error inflating class
PreferenceFragment.getParser(String xml)
方法。我看到你将public static final String LAYOUT
传递给了你的getParser()
方法,并将LAYOUT
作为View
填充。你是如何生成String LAYOUT
的?我猜测你以某种方式编码了你的布局的已编译代码,但我想知道细节,以便我可以将自己的布局编码成与你为LAYOUT
所做的相同格式...? - Wessbyte[] data
并传递给Object block = constructor.newInstance(data);
。不确定我做错了什么?任何帮助将不胜感激。 - WessBad XML block: header size 28024 or total size 1702240364 is larger than data size 2757
- SamiAzar