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.

How to Add Views to the Scroll View in Android? -


i create following code create bar chart , pie chart using canvas.

here code

public class chartdemo extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      //scrollview sv = new scrollview(this);      linearlayout llay = new linearlayout(this);     llay.setorientation(linearlayout.vertical);      float[] values = { 50, 100, 50, 20, 30, 60, 100, 90 };      // bar chart     bargraph barchart = new bargraph(this, values);     llay.addview(barchart);      //pie chart     piechartview pie = new piechartview(this, values);     llay.addview(pie);      //sv.addview(llay);      setcontentview(llay);     //setcontentview(sv);    }  } 

the above code show barchart only. change code following gives black(blank)screen only.with out no error , exception

  public class chartdemo extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      scrollview sv = new scrollview(this);      linearlayout llay = new linearlayout(this);     llay.setorientation(linearlayout.vertical);      float[] values = { 50, 100, 50, 20, 30, 60, 100, 90 };      // bar chart     bargraph barchart = new bargraph(this, values);     llay.addview(barchart);      //pie chart     piechartview pie = new piechartview(this, values);     llay.addview(pie);      sv.addview(llay);      setcontentview(sv);    }  } 

and create chart views following

public class piechartview extends view {  private float[] values;   public piechartview(context context, float[] values) {     super(context);      this.values = values;  }  protected void ondraw(canvas canvas) {     super.ondraw(canvas);                 .......                .........          }   } 

i need add both chart in single screen scroll view . not able add both in single activity.how ??

when add programmatically views layout, linearlayout or scrollview (which derives framelayout), should set layout parameters on views, (just example):

bargraph barchart = new bargraph(this, values); // sure use correct layout params layout linearlayout.layoutparams llp = new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); llp.weight = 1.0f; barchart.setlayoutparams(llp); llay.addview(barchart);  framelayout.layoutparams flp = new /* ... */; llay.setlayoutparams(flp);  sv.addview(llay); 

if don't set them, default ones depending on layout, , might job or not depending on added views. (btw conventionally in java variables names begin lower case)


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 -