Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Add Views to the Scroll View in Android?
    primarykey
    data
    text
    <p>I create the following code to create the Bar Chart and Pie Chart using Canvas.</p> <p>Here is my code</p> <pre><code>public class ChartDemo extends Activity { /** Called when the activity is 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); } } </code></pre> <p>The above code show the BarChart only. I change my code like the following it gives the Black(blank)Screen only.With out no error and exception</p> <pre><code> public class ChartDemo extends Activity { /** Called when the activity is 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); } } </code></pre> <p>And i create my Chart Views like the following </p> <pre><code>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); ....... ......... } } </code></pre> <p>I need to add both chart in Single Screen with Scroll View . But i am not able to add Both in the single Activity.How to do this ?? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload