Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Style first 2 TextViews in Android ListView differently -


i have listview , want first 2 entries in displayed differently rest. nothing fancy, want them text views. first 2 entries need have different sizes , weights rest. tried modifying arrayadapter class so:

private class busstopadapter<t> extends arrayadapter<t>{    public busstopadapter(       context context, int textviewresourceid,     list<t> objects)   {     super(context, textviewresourceid, objects);   }    public view getview(int position, view convertview,      viewgroup parent)   {     textview toreturn =        (textview)super.getview(position, convertview, parent);     if(position == 0){      toreturn.settextsize(12);      toreturn.settext("previous bus: " + toreturn.gettext());      toreturn.setpadding(0,0,0,0);     }     else if(position == 1){       toreturn.settextsize(20);       toreturn.setpadding(         toreturn.getpaddingleft(),         0,         toreturn.getpaddingright(),         0       );       toreturn.settext("next bus: " + toreturn.gettext());       toreturn.setgravity(gravity.center_horizontal|gravity.top);     }     return toreturn;   }  } 

but inadvertantly causes of other textviews take on these special attributes. think it's because cause textviews "recycled" in abslistadapter class.

try this:

if(position == 0){      toreturn.settextsize(12);      toreturn.settext("previous bus: " + toreturn.gettext());      toreturn.setpadding(0,0,0,0);     }     else if(position == 1){       toreturn.settextsize(20);       toreturn.setpadding(         toreturn.getpaddingleft(),         0,         toreturn.getpaddingright(),         0       );    else       style or whatever want......... 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -