我一直在使用 GraphView 库。我必须以编程方式添加添加 GraphView。
当我将图形添加到 RelativeLayout 时,如果 textview 填充页面,它将不会显示图形。但如果 textview 为空或未完全填充页面,图形将显示但不是全部。它根本不会滚动....
我正在尝试在 textview 下添加图形。
这是我的xml
<ScrollView
android:id="@+id/ScrollView02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbars="none" >
<RelativeLayout
android:id="@+id/reletive_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
</RelativeLayout>
</ScrollView>
代码...
GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] {
new GraphViewData(1, 2.0d)
, new GraphViewData(2, 1.5d)
, new GraphViewData(3, 2.5d)
, new GraphViewData(4, 1.0d)
});
GraphView graphView = new LineGraphView(getActivity(), "GraphViewDemo");
graphView.addSeries(exampleSeries); // data
RelativeLayout layout = (RelativeLayout) v.findViewById(R.id.reletive_layout);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.BELOW, tv2.getId());
layout.addView(graphView,params);
我存了几天,提前谢谢。