string - TextView multiple lines using \n not working - Android -
here textview need have multiple lines on
<textview android:id="@+id/date1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/title" android:textcolor="#343434" android:textsize="14sp" android:layout_margintop="1dip" android:layout_torightof="@id/list_image" android:layout_marginleft="4dp" android:maxlines="3"/>
this textview gets used in listview have text being set via adapter.class. looking @ individual xml file used set style textview when add string \n in it works fine try , using class not work , says things along lines of "this text\nthis more." textview's text set line in adapter.class
date1.settext(song.get(customizedlistview.key_date1));
customizedlistview.class sets listview , gives adapter it's strings required set text. know why using set strings via class not work \n? have heard line above has changed in way work unsure how. reading , helping.
adapter.class
public class lazyadapter extends baseadapter { private activity activity; private arraylist<hashmap<string, string>> data; private static layoutinflater inflater=null; public imageloader imageloader; public lazyadapter(activity a, arraylist<hashmap<string, string>> d) { activity = a; data=d; inflater = (layoutinflater)activity.getsystemservice(context.layout_inflater_service); imageloader=new imageloader(activity.getapplicationcontext()); } public int getcount() { return data.size(); } public object getitem(int position) { return position; } public long getitemid(int position) { return position; } public view getview(int position, view convertview, viewgroup parent) { view vi=convertview; if(convertview==null) vi = inflater.inflate(r.layout.list_row, null); textview title = (textview)vi.findviewbyid(r.id.title); // title textview date1 = (textview)vi.findviewbyid(r.id.date1); textview platforms = (textview)vi.findviewbyid(r.id.platforms); imageview thumb_image=(imageview)vi.findviewbyid(r.id.list_image); // thumb image hashmap<string, string> song = new hashmap<string, string>(); song = data.get(position); // setting values in listview title.settext(song.get(customizedlistview.key_title)); date1.settext(song.get(customizedlistview.key_date1)); platforms.settext(song.get(customizedlistview.key_platforms)); imageloader.displayimage(song.get(customizedlistview.key_thumb_url), thumb_image); return vi; } }
Comments
Post a Comment