我有一个 jjoe64 GraphView
。我试图将它添加到 HorizontalScrollView
中。在此 ScrollView 中,我添加了一个 Relative Layout
,然后在其中添加了 GraphView
。但它不能滚动。这是我的 xml,
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/horizontalScrollView"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textViewHR"
android:fillViewport="true"
android:layout_alignParentEnd="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignTop="@+id/horizontalScrollView">
<com.jjoe64.graphview.GraphView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/graph"
android:nestedScrollingEnabled="false" />
</RelativeLayout>
</HorizontalScrollView>
我运行代码并尝试滚动。但它不能滚动。我该如何解决这个问题。
提前致谢!
最佳答案
HorizontalScrollView 不是必需的。
您需要更改视口(viewport)的可滚动性,如下所示:
graphView = (GraphView) findViewById(R.id.graph);
graphView.getViewport().setScrollable(true);
参见 http://jjoe64.github.io/GraphView/javadoc/com/jjoe64/graphview/Viewport.html#setScrollable-boolean-
关于java - 如何将 GraphView 添加到 android 中的滚动 Pane 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28556567/