這是我的XML與2 LinearLayouts
。如何將另一個視圖充氣到LinearLayout?
<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>
我已經從http://android.arnodenhond.com/components/graphview下載GraphView。這個類擴展了View。我基本上是想通過
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);
初始化2個圖形,然後膨脹成graphView
ll_one
和graphView2
爲ll_two
。
我該怎麼做?我初始化了LinearLayout
llOne = (LinearLayout) findViewById(R.id.ll_one);
,但它沒有inflate()
方法。
如果是,請將其標記爲答案。 – breceivemail
謝謝,但我正在尋找一種方法來以編程方式做到這一點。 – sandalone