简体   繁体   中英

Android CoordinatorLayout Scrolling Entire View

I have a ViewPager activity that uses CoordinatorLayout and a couple of tabs. In each tab, I have these pretty large Fragment s that will not fit all the way onto a user's screen. I want the user to be able to scroll up and down to see the entire Fragment . I obviously also want the scroll events to be picked up by CoordinatorLayout which will hide the Toolbar . I have the Toolbar hiding on scroll working, but after the Toolbar is hidden from the CoordinatorLayout scroll, I cannot scroll anymore to see the rest of my view below.

How can I get this behavior?

Here is my simple ViewPager activity layout

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.currencylist.CurrencyListTabsActivity"
android:orientation="vertical">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/appBarLayout"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_currency_details"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:layout_scrollFlags="scroll|enterAlways|snap"/>

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

<android.support.v4.view.ViewPager
    android:id="@+id/currencyTabsViewPager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="0dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

Here is my Fragment layout that I cannot for the life of me get to scroll:

<?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.chartandprice.CurrencyDetailsTabsActivity"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fillViewport="true">

    <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/swipe_refresh_layout"
        android:layout_gravity="center|bottom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/graph_fragment_horizontal_margin"
        android:paddingRight="@dimen/graph_fragment_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.chartandprice.CurrencyDetailsTabsActivity">

        <TextView
            android:id="@+id/current_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:textSize="16sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/graphFragmentDateTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:textSize="12sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.501"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/current_price" />


        <TextView
            android:id="@+id/percent_change"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:textSize="12sp"
            android:textStyle="bold"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/graphFragmentDateTextView" />

        <com.github.mikephil.charting.charts.LineChart
            android:id="@+id/chart"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="2dp"
            android:layout_marginStart="2dp"
            android:focusableInTouchMode="true"
            android:padding="0dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline5"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline6" />

        <com.nex3z.togglebuttongroup.SingleSelectToggleGroup
            android:id="@+id/chart_interval_button_grp"
            android:layout_width="384dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline6"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/percent_change"
            app:tbgCheckedButton="@+id/dayButton"
            app:tbgChildSpacing="auto">

            <com.nex3z.togglebuttongroup.button.CircularToggle
                android:id="@+id/dayButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/oneDay"
                android:textSize="16sp"
                app:tbgMarkerColor="@color/colorAccent" />

            <com.nex3z.togglebuttongroup.button.CircularToggle
                android:id="@+id/weekButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/Week"
                android:textSize="16sp"
                app:tbgMarkerColor="@color/colorAccent" />

            <com.nex3z.togglebuttongroup.button.CircularToggle
                android:id="@+id/monthButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/Month"
                android:textSize="16sp"
                app:tbgMarkerColor="@color/colorAccent" />

            <com.nex3z.togglebuttongroup.button.CircularToggle
                android:id="@+id/threeMonthButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/threeMonth"
                android:textSize="16sp"
                app:tbgMarkerColor="@color/colorAccent" />

            <com.nex3z.togglebuttongroup.button.CircularToggle
                android:id="@+id/yearButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/Year"
                android:textSize="16sp"
                app:tbgMarkerColor="@color/colorAccent" />

            <com.nex3z.togglebuttongroup.button.CircularToggle
                android:id="@+id/allTimeButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/All"
                android:textSize="16sp"
                app:tbgMarkerColor="@color/colorAccent" />

        </com.nex3z.togglebuttongroup.SingleSelectToggleGroup>

        <android.support.constraint.Guideline
            android:id="@+id/guideline5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.5" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.15" />

            <TableLayout
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginEnd="8dp"
                android:layout_marginStart="8dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/guideline5">

                <TableRow
                    android:id="@+id/nameTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableNameTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Name" />

                    <TextView
                        android:id="@+id/tableNameDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/symbolTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableSymbolTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Symbol" />

                    <TextView
                        android:id="@+id/tableSymbolDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/priceUSDTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tablePriceUSDTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Price (USD)" />

                    <TextView
                        android:id="@+id/tablePriceUSDDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/priceBTCTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tablePriceBTCTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Price (BTC)" />

                    <TextView
                        android:id="@+id/tablePriceBTCDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />

                </TableRow>

                <TableRow
                    android:id="@+id/volUSDTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableVolUSDTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="24h Volume" />

                    <TextView
                        android:id="@+id/tableVolUSDDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/mktCapUSDTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableMktCapTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Market Cap" />

                    <TextView
                        android:id="@+id/tableMktCapDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/availableSupplyTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableAvailableSupplyTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Available Supply" />

                    <TextView
                        android:id="@+id/tableAvailableSupplyDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/totalSupplyTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableTotalSupplyTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Total Supply" />

                    <TextView
                        android:id="@+id/tableTotalSupplyDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/maxSupplyTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/tableMaxSupplyTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Max Supply" />

                    <TextView
                        android:id="@+id/tableMaxSupplyDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="textEnd" />
                </TableRow>

                <TableRow
                    android:id="@+id/changeTitlesTableRow"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/table1hrChangeTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Change 1hr"
                        android:textAlignment="center" />

                    <TextView
                        android:id="@+id/table24hrChangeTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="Change 24hr"
                        android:textAlignment="center" />

                    <TextView
                        android:id="@+id/tableWeekChangeTitleTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="3"
                        android:text="Change 7d"
                        android:textAlignment="center" />

                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/table1hrChangeDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="TextView"
                        android:textAlignment="center" />

                    <TextView
                        android:id="@+id/table24hrChangeDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:text="TextView"
                        android:textAlignment="center" />

                    <TextView
                        android:id="@+id/table7dChangeDataTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="3"
                        android:text="TextView"
                        android:textAlignment="center" />
                </TableRow>
            </TableLayout>

    </android.support.constraint.ConstraintLayout>
        </ScrollView>

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

From your fragment code:

  1. Remove the outermost NestedScrollView . You don't need it.
  2. Add app:layout_behavior="@string/appbar_scrolling_view_behavior" to the SwipeRefreshLayout which has become the new parent.
  3. Change the inner ScrollView to NestedScrollView .

Let us know if it works.

I found the solution. There were 2 problems:

  1. I was using guidelines in the ConstraintLayout .
  2. I had the height/width of some elements in my ConstraintLayout set to match_constraint .

I removed the guidelines and gave all of my layout elements raw height/width values in dp . That seems to have fixed the problem.

It seems that the scrolling does not play nicely fitting elements inside of guidelines

Here is my xml now:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/graphFragmentNestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/graph_fragment_horizontal_margin"
    android:paddingRight="@dimen/graph_fragment_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin">

    <TextView
        android:id="@+id/current_price"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:textSize="16sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/graphFragmentDateTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:textSize="12sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/current_price" />


    <TextView
        android:id="@+id/percent_change"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:textSize="12sp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/graphFragmentDateTextView" />

    <com.nex3z.togglebuttongroup.SingleSelectToggleGroup
        android:id="@+id/chart_interval_button_grp"
        android:layout_width="362dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/percent_change"
        app:tbgCheckedButton="@+id/dayButton"
        app:tbgChildSpacing="auto">

        <com.nex3z.togglebuttongroup.button.CircularToggle
            android:id="@+id/dayButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/oneDay"
            android:textSize="16sp"
            app:tbgMarkerColor="@color/colorAccent" />

        <com.nex3z.togglebuttongroup.button.CircularToggle
            android:id="@+id/weekButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Week"
            android:textSize="16sp"
            app:tbgMarkerColor="@color/colorAccent" />

        <com.nex3z.togglebuttongroup.button.CircularToggle
            android:id="@+id/monthButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Month"
            android:textSize="16sp"
            app:tbgMarkerColor="@color/colorAccent" />

        <com.nex3z.togglebuttongroup.button.CircularToggle
            android:id="@+id/threeMonthButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/threeMonth"
            android:textSize="16sp"
            app:tbgMarkerColor="@color/colorAccent" />

        <com.nex3z.togglebuttongroup.button.CircularToggle
            android:id="@+id/yearButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Year"
            android:textSize="16sp"
            app:tbgMarkerColor="@color/colorAccent" />

        <com.nex3z.togglebuttongroup.button.CircularToggle
            android:id="@+id/allTimeButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/All"
            android:textSize="16sp"
            app:tbgMarkerColor="@color/colorAccent" />

    </com.nex3z.togglebuttongroup.SingleSelectToggleGroup>

    <com.github.mikephil.charting.charts.LineChart
        android:id="@+id/chart"
        android:layout_width="match_parent"
        android:layout_height="275dp"
        android:layout_marginTop="8dp"
        android:focusableInTouchMode="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/chart_interval_button_grp" />

    <TableLayout
        android:id="@+id/tableLayoutGraphFragment"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:paddingBottom="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/chart">

        <TableRow
            android:id="@+id/nameTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lightGray">

            <TextView
                android:id="@+id/tableNameTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Name" />

            <TextView
                android:id="@+id/tableNameDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/priceUSDTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/tablePriceUSDTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Price (USD)" />

            <TextView
                android:id="@+id/tablePriceUSDDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/priceBTCTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lightGray">

            <TextView
                android:id="@+id/tablePriceBTCTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Price (BTC)" />

            <TextView
                android:id="@+id/tablePriceBTCDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />

        </TableRow>

        <TableRow
            android:id="@+id/volUSDTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/tableVolUSDTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="24h Volume" />

            <TextView
                android:id="@+id/tableVolUSDDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/mktCapUSDTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lightGray">

            <TextView
                android:id="@+id/tableMktCapTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Market Cap" />

            <TextView
                android:id="@+id/tableMktCapDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/availableSupplyTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/tableAvailableSupplyTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Available Supply" />

            <TextView
                android:id="@+id/tableAvailableSupplyDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/totalSupplyTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lightGray">

            <TextView
                android:id="@+id/tableTotalSupplyTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Total Supply" />

            <TextView
                android:id="@+id/tableTotalSupplyDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/maxSupplyTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/tableMaxSupplyTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Max Supply" />

            <TextView
                android:id="@+id/tableMaxSupplyDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="textEnd" />
        </TableRow>

        <TableRow
            android:id="@+id/changeTitlesTableRow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lightGray">

            <TextView
                android:id="@+id/table1hrChangeTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="8dp"
                android:text="Change 1hr"
                android:textAlignment="center" />

            <TextView
                android:id="@+id/table24hrChangeTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingStart="8dp"
                android:text="Change 24hr"
                android:textAlignment="center" />

            <TextView
                android:id="@+id/tableWeekChangeTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="3"
                android:paddingStart="8dp"
                android:text="Change 7d"
                android:textAlignment="center" />

        </TableRow>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lightGray">

            <TextView
                android:id="@+id/table1hrChangeDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingEnd="8dp"
                android:textAlignment="center"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/table24hrChangeDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:paddingEnd="8dp"
                android:textAlignment="center"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tableWeekChangeDataTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="3"
                android:paddingEnd="8dp"
                android:textAlignment="center"
                android:textStyle="bold" />
        </TableRow>
    </TableLayout>

</android.support.constraint.ConstraintLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM