gpt4 book ai didi

androidplot - 如何使域网格线滚动

转载 作者:行者123 更新时间:2023-12-02 04:54:40 30 4
gpt4 key购买 nike

AndroidPlot 是一个很棒的库。我关注了http://androidplot.com/docs/how-to-pan-zoom-and-scale/制作可滚动图表,但发现在图表滚动时域网格线是固定的。是否可以让网格线随图表滚动?

谢谢

最佳答案

我用线性布局包裹了我的图表:

 <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 文件中,我将 View 分配给线性布局并将 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);
....

这对我有用。

关于androidplot - 如何使域网格线滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24113377/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com