Ganesh Putta
Ganesh Putta

Reputation: 2681

Android ScrollView Is not working, tried all the answers

am new to android development, I have much content but scroll is not at all working on my app, tried with all on answers in stackoverflow, but nothing works for me. Any help Would be appreciated!

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:scrollbars="none" >


    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/scoreview"

            android:background="@android:color/black"
            xmlns:tools="http://schemas.android.com/tools"
            tools:context="com.example.saikumar.cricket.ScoreDisplay"
            >
            <RelativeLayout
                android:id="@+id/loadingPanel"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center" >
                <ProgressBar
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:indeterminate="true" />
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/matchtitle_layout">
                <Button
                    android:id="@+id/match_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:padding="10dp"
                    android:text="Loading..."
                    android:fontFamily="monospace"
                    android:textColor="@android:color/white"
                    android:textSize="13dp"
                    android:clickable="false"
                    android:background="@color/colorPrimary"
                    />
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/score_layout"
                android:visibility="gone"
                android:layout_below="@+id/matchtitle_layout"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    >
                    <TextView
                        android:id="@+id/score"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Score"
                        android:padding="10dp"
                        android:textColor="@android:color/white"
                        android:textSize="15dp"
                        android:fontFamily="monospace"
                        android:textStyle="bold"
                        />
                    <TextView
                        android:id="@+id/scoreruns"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="3"
                        android:text="Score"
                        android:fontFamily="monospace"
                        android:padding="10dp"
                        android:paddingLeft="0dp"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        android:layout_below="@+id/match_title"
                        android:layout_alignEnd="@+id/overscount" />
                </LinearLayout>
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/score_layout"
                android:id="@+id/bowler_layout"
                android:visibility="gone"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                    <TextView
                        android:id="@+id/bowler"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Bowler"
                        android:padding="10dp"
                        android:textColor="@android:color/white"
                        android:textSize="15dp"
                        android:fontFamily="monospace"
                        android:textStyle="bold"
                        />
                    <TextView
                        android:id="@+id/bowlername"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="3"
                        android:text="Name"
                        android:fontFamily="monospace"
                        android:padding="10dp"
                        android:paddingLeft="0dp"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        android:layout_below="@+id/match_title"
                        android:layout_alignEnd="@+id/overscount" />
                </LinearLayout>
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/innings"
                android:layout_below="@+id/bowler_layout"
                >
                <TextView
                    android:id="@+id/total"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Loading..."
                    android:padding="20dp"
                    android:fontFamily="monospace"
                    android:textSize="15dp"
                    android:textColor="@android:color/white"
                    />
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/innings"
                android:id="@+id/heading_innings"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@android:color/holo_red_light"
                    android:padding="10dip"
                    >
                    <TextView
                        android:id="@+id/batsman"
                        android:layout_width="140dp"
                        android:layout_height="wrap_content"
                        android:text="BatsMan"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="R"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="B"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="4s"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="6s"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="SR"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                </LinearLayout>
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/batting_reltive_layout_one"
                android:layout_below="@+id/heading_innings"
                >
                <ListView
                    android:id="@+id/batting_runs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:layout_editor_absoluteX="8dp"
                    tools:layout_editor_absoluteY="8dp"
                    android:padding="1dp"/>
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/inningstwo"
                android:layout_below="@+id/batting_reltive_layout_one"
                >
                <TextView
                    android:id="@+id/totalsecond"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Loading..."
                    android:padding="20dp"
                    android:fontFamily="monospace"
                    android:textSize="15dp"
                    android:textColor="@android:color/white"
                    />
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/inningstwo"
                android:id="@+id/heading_innings_two"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@android:color/holo_red_light"
                    android:padding="10dip"
                    >

                    <TextView
                        android:layout_width="140dp"
                        android:layout_height="wrap_content"
                        android:text="BatsMan"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="R"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="B"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="4s"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="6s"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="SR"
                        android:fontFamily="monospace"
                        android:textSize="15dp"
                        android:textColor="@android:color/white"
                        />
                </LinearLayout>
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/batting_reltive_layout_two"
                android:layout_below="@+id/heading_innings_two"
                >
                <ListView
                    android:isScrollContainer="false"
                    android:id="@+id/batting_runs_two"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:layout_editor_absoluteX="8dp"
                    tools:layout_editor_absoluteY="8dp"
                    android:padding="1dp"/>
            </RelativeLayout>

        </RelativeLayout>


</ScrollView>

Upvotes: 0

Views: 45

Answers (2)

FaBioInsolia
FaBioInsolia

Reputation: 96

NestedScrollView instead of Scrollview should solve your issue. On a complete different topic, since you are starting now with android develpment I suggest you sto study/use RecycleView instead of ListView. RecycleView are easier to implement, great retrocompatibility and don't need the "view holder pattern" in order to improve performance. Here is a link that can help you to grasp some basic concept:

https://guides.codepath.com/android/using-the-recyclerview

Upvotes: 1

barotia
barotia

Reputation: 428

Try with NestedScrollView, the problem can be that you have a listview, in scrollview.

Upvotes: 0

Related Questions