2016-08-20 23 views
2

私はいくつかの折れ線グラフを表示しようとしていますが、グラフを表示するページでスクロールが機能していません。私は、コーディネーターレイアウトの内側にあるビューページャーを使用します。MPAndroidChartラインチャートの問題

私も次のことを達成したいと思います:

  • 曲線のラインを終了し、私がコーディネーターレイアウトとViewpagerは時々いくつかが必要であることを知っている伝説

から色のラベルを終了しますしかし、この瞬間まで私は解決策を見つけることができませんでした。

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/coordinator_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/app_bar_layout" 
    android:layout_width="match_parent" 
    android:layout_height="112dp" 
    android:background="@color/colorPrimary" 
    android:elevation="@dimen/elevation_toolbar" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:contentScrim="@color/colorPrimary" 
     app:expandedTitleMarginEnd="64dp" 
     app:expandedTitleMarginStart="48dp" 
     app:layout_scrollFlags="scroll|enterAlways" 
     android:fitsSystemWindows="true"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?actionBarSize" 
      android:layout_marginLeft="@dimen/list_toolbar_side_margin" 
      android:layout_marginRight="@dimen/list_toolbar_side_margin" 
      app:layout_collapseMode="pin" /> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      style="@style/AppTabLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      app:tabGravity="fill" 
      app:tabMode="fixed" 
      app:tabTextAppearance="@style/AppTabTextAppearance"/> 

    </android.support.design.widget.CollapsingToolbarLayout> 

</android.support.design.widget.AppBarLayout> 

<ProgressBar 
    android:id="@+id/progress_bar_garden" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" 
    android:visibility="gone"/> 

<android.support.v4.view.ViewPager 
    android:id="@+id/viewpager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    /> 

やチャートフラグメントのxml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <ProgressBar 
     android:id="@+id/progress_bar_charts" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:visibility="gone" /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <com.github.mikephil.charting.charts.LineChart 
      android:id="@+id/temp_chart" 
      android:layout_width="@dimen/show_plant_chart_width" 
      android:layout_height="@dimen/show_plant_chart_height" 
      android:layout_marginStart="@dimen/show_plant_chart_margin_start" /> 

     <com.github.mikephil.charting.charts.LineChart 
      android:id="@+id/humidity_chart" 
      android:layout_width="@dimen/show_plant_chart_width" 
      android:layout_height="@dimen/show_plant_chart_height" 
      android:layout_marginStart="@dimen/show_plant_chart_margin_start" 
      android:layout_marginTop="@dimen/show_plant_chart_margin_top" /> 

    </LinearLayout> 

</RelativeLayout> 
私は

resume charts

charts stop scrolling

メインのxml ...もっとチャートを追加する必要があります

答えて

1

リサイクルビューを使用してこの問題を解決しました。 MPAndroidChart Line ChartはScrollViewに問題があるようです。私はなぜそうではありません。

+0

私はあなたのソリューションを試しましたが、それは私のために働いていません。折れ線グラフ上を横にスクロールしようとすると、タブレイアウトがタブを切り替えるでしょう。偶数android:nestedScrollingEnabled = "false"は機能しません –

関連する問題