This is my XML with 2 LinearLayouts.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/ll_one"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout
android:id="@+id/ll_two"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
I have downloaded GraphView from http://android.arnodenhond.com/components/graphview. This class extends View. I basically want to initialize 2 graphs via
String[] verlabels = new String[]{"aim", "25%", "50%", "75%", "start"};
String[] horlabels = new String[]{"this", "max"};
float[] values = new float[]{2.0f, 6.0f};
aaaGraphView graphView = new aaaGraphView(this, values, "Graph One",
horlabels, verlabels, aaaGraphView.BAR);
float[] values2 = new float[]{1.0f, 12.0f};
aaaGraphView graphView2 = new aaaGraphView(this, values2, "Graph Two",
horlabels, verlabels, aaaGraphView.BAR);
and then to inflate graphView into ll_one, and graphView2 into ll_two.
How should I do this? I have initialized the LinearLayout
llOne = (LinearLayout) findViewById(R.id.ll_one);
but it does not have inflate() method.
You do not need to
inflateanotherviewinside yourLinearLayoutyou’ll just have to add another child inside thatLinearLayout. Just use theaddView()method on theLinearLayoutthat fits you the best. Here is an example :