Nestedscroll с виджетом и графиком - PullRequest
0 голосов
/ 29 июня 2019

Я хочу прокрутить с помощью пейджера просмотра и диаграммы с указанным выше, и все это с помощью вложенной прокрутки, но я не нашел никакого решения для этого, также я попробовал раскладку Координатора для этого, но все еще безуспешно, пожалуйста, помогите, если у какого-либо органа есть решение. Спасибо .

Мой макет ниже

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="vertical">

<include
    android:id="@+id/toolbar"
    layout="@layout/tool_bar" />

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background_top_corner">

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

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="150dp">

            <com.github.mikephil.charting.charts.PieChart
                android:id="@+id/pchart"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>
        </RelativeLayout>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            style="@style/AppTabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/dimen_ten"
            android:layout_marginRight="@dimen/dimen_ten">

            <android.support.design.widget.TabItem
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout="@layout/row_open_tab" />

            <android.support.design.widget.TabItem
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout="@layout/row_delivered_tab" />
        </android.support.design.widget.TabLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/vp_docket_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/colorBackground"
            android:nestedScrollingEnabled="true" />

    </LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>

1 Ответ

0 голосов
/ 29 июня 2019

Сделайте ваш макет вот так.Это должно работать.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/light_white">

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

            <com.db.chart.view.LineChartView
                android:id="@+id/linechart"
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:layout_marginTop="20dp"/>

            <android.support.v4.view.ViewPager
                android:id="@+id/view_pager"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

</LinearLayout>
...