Android换行(textView)

TextView text = (TextView)this.findViewById(R.id.content);
        InputStream iStream = XMLActivity.class.getClassLoader().getResourceAsStream("person.xml");
        List<Person> personList;
		try {
			personList = SAXService.readXML(iStream);
	        StringBuffer strB = new StringBuffer();
	        for(Person person:personList)
	        {
	        	String str = person.toString();
	        	strB.append(str);
	        	strB.append("<br />");
	        }
	        text.setText(Html.fromHtml(strB.toString()));
		}
	    catch(Exception e){
			Log.i(TAG, "Xml Load failure!");
			Toast.makeText(XMLActivity.this, "Xml Load failure!", 1).show();
			e.printStackTrace();
		}

strB.append("<br />");  

text.setText(Html.fromHtml(strB.toString()));

你可能感兴趣的:(html,xml,android)