Java 如何在android中将GraphView添加到滚动窗格中?
我有一个jjoe64图形视图。我试图将其添加到Java 如何在android中将GraphView添加到滚动窗格中?,java,android,android-graphview,Java,Android,Android Graphview,我有一个jjoe64图形视图。我试图将其添加到水平滚动视图中。在这个滚动视图中,我添加了一个相对布局,然后在其中添加了图形视图。但它不能滚动。这是我的xml <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/horizontalSc
水平滚动视图中
。在这个滚动视图中,我添加了一个相对布局
,然后在其中添加了图形视图
。但它不能滚动。这是我的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>
我运行代码并尝试滚动。但它不能滚动。我怎样才能解决这个问题
提前谢谢 不需要水平滚动视图。
您需要更改视口的可滚动性,如下所示:
graphView = (GraphView) findViewById(R.id.graph);
graphView.getViewport().setScrollable(true);
看