AndroidPlot是一個很棒的庫。 我跟着http://androidplot.com/docs/how-to-pan-zoom-and-scale/製作了一個可滾動的圖表,但發現網格線條在圖表滾動時是固定的。是否可以使網格線與圖表一起滾動?如何使網格線滾動
感謝
AndroidPlot是一個很棒的庫。 我跟着http://androidplot.com/docs/how-to-pan-zoom-and-scale/製作了一個可滾動的圖表,但發現網格線條在圖表滾動時是固定的。是否可以使網格線與圖表一起滾動?如何使網格線滾動
感謝
看看this similar question - 它包含一個鏈接到你想要做什麼的例子源。
我包我的線性佈局圖:
<LinearLayout
android:id="@+id/graphLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.androidplot.xy.XYPlot
android:id="@+id/mySimpleXYPlot"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
....
然後,在我分配視圖到線性佈局的.java文件和onTouchListener設置爲佈局:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_graph);
LinearLayout view = (LinearLayout) findViewById(R.id.graphLayout); // assign layout graph is in
view.setOnTouchListener(this); // set onTouchListener to graph's layout
plot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
....
即爲我工作。
感謝Nick,我的意思是,當左右滾動時,域標記線(標記X軸上的值的垂直線)是固定的,每個線的值在滾動期間更新。現在我想要的是,讓這些線條在滾動時隨着圖表一起移動,並保持每行的值不變。 –
在這種情況下,我知道這樣做的唯一方法就是將圖塊嵌入到ScrollView中。由於潛在的性能問題,我不是這種方法的粉絲,但如果你不繪製數千個點,它可以工作。 – Nick