GraphView 不显示
GraphView is not displayed
我尝试使用 GraphView 绘制折线图。
使用的代码是:
if (list.size() > 0) {
GraphView graph = new LineGraphView(this, "Score");
GraphViewData[] graphData = new GraphViewData[list.size()];
for (int i = 0; i < list.size(); i++) {
graphData[i] = new GraphViewData(i, list.get(i).getScore());
}
graph.getGraphViewStyle().setNumHorizontalLabels(list.size());
graph.getGraphViewStyle().setNumVerticalLabels(list.size());
graph.getGraphViewStyle().setGridColor(getResources().getColor(R.color.blue));
graph.getGraphViewStyle().setHorizontalLabelsColor(getResources().getColor(R.color.greenYes));
graph.addSeries(new GraphViewSeries(graphData));
mLayout.addView(graph);
}
但是在此代码执行结束后,屏幕保持白色,即屏幕上没有任何内容。列表大小 >0.
xml 是:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/tvLevelCompleteScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="@dimen/textSize25" />
<TextView
android:id="@+id/tvLevelCompleteCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="@dimen/textSize25" />
</LinearLayout>
</ScrollView>
mlayout初始化为:
mLayout = (LinearLayout) findViewById(R.id.linearLayout);
知道我错过了什么吗?
非常感谢任何帮助。
谢谢
不支持内卷。删除滚动视图后工作正常。
我尝试使用 GraphView 绘制折线图。 使用的代码是:
if (list.size() > 0) {
GraphView graph = new LineGraphView(this, "Score");
GraphViewData[] graphData = new GraphViewData[list.size()];
for (int i = 0; i < list.size(); i++) {
graphData[i] = new GraphViewData(i, list.get(i).getScore());
}
graph.getGraphViewStyle().setNumHorizontalLabels(list.size());
graph.getGraphViewStyle().setNumVerticalLabels(list.size());
graph.getGraphViewStyle().setGridColor(getResources().getColor(R.color.blue));
graph.getGraphViewStyle().setHorizontalLabelsColor(getResources().getColor(R.color.greenYes));
graph.addSeries(new GraphViewSeries(graphData));
mLayout.addView(graph);
}
但是在此代码执行结束后,屏幕保持白色,即屏幕上没有任何内容。列表大小 >0.
xml 是:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/tvLevelCompleteScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="@dimen/textSize25" />
<TextView
android:id="@+id/tvLevelCompleteCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="@dimen/textSize25" />
</LinearLayout>
</ScrollView>
mlayout初始化为:
mLayout = (LinearLayout) findViewById(R.id.linearLayout);
知道我错过了什么吗?
非常感谢任何帮助。
谢谢
不支持内卷。删除滚动视图后工作正常。