I developed an android application in which the scroll-view is not scrolling.. I am posting the code here pls check and if found any error pls help.. Here I used Linear Layout as root and then Scroll-view and Relative Layout inside the scroll-view and ... text-views inside relative layout... but this is not scrolling up..
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/orange"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/header901"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/green"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:gravity="center">
<TextView
android:id="@+id/headertext901"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:textColor="#ffffff"
android:textSize="20sp"
android:text="Result"
android:textStyle="bold"
/>
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView901"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:fillViewport="true">
<RelativeLayout
android:id="@+id/lLayout901"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:layout_marginTop="22dp"
android:text="Your Destiny number is :" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_alignParentRight="true"
android:layout_marginRight="44dp"
android:text="TextView" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="18dp"
android:text="Your result is loading......" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView3"
android:layout_below="@+id/textView3"
android:layout_marginTop="16dp"
android:text="Your Talent Number is :" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView4"
android:layout_alignBottom="@+id/textView4"
android:layout_alignLeft="@+id/textView2"
android:text="TextView" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView4"
android:layout_below="@+id/textView4"
android:layout_marginTop="20dp"
android:text="Your result is loading......." />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView6"
android:layout_below="@+id/textView6"
android:layout_marginTop="16dp"
android:text="Your Heart Number is :" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView7"
android:layout_alignBottom="@+id/textView7"
android:layout_alignLeft="@+id/textView5"
android:text="TextView" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView7"
android:layout_centerVertical="true"
android:text="Your result is loading...." />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView9"
android:layout_below="@+id/textView9"
android:layout_marginTop="20dp"
android:text="Your Personality number is :" />
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView10"
android:layout_alignLeft="@+id/textView8"
android:text="TextView" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView10"
android:layout_below="@+id/textView10"
android:layout_marginTop="18dp"
android:text="Your result is loading...." />
<TextView
android:id="@+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView12"
android:layout_below="@+id/textView12"
android:layout_marginTop="18dp"
android:text="Your Minor expression no:" />
<TextView
android:id="@+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView13"
android:layout_alignLeft="@+id/textView11"
android:text="TextView" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView13"
android:layout_below="@+id/textView13"
android:layout_marginTop="18dp"
android:text="Your result is loading....." />
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView15"
android:layout_below="@+id/textView15"
android:layout_marginTop="18dp"
android:text="Your Minor Heart Desire no:" />
<TextView
android:id="@+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView16"
android:layout_alignLeft="@+id/textView14"
android:text="TextView" />
<TextView
android:id="@+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView16"
android:layout_below="@+id/textView16"
android:layout_marginTop="18dp"
android:text="Your result is loading....." />
<TextView
android:id="@+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView18"
android:layout_below="@+id/textView18"
android:layout_marginTop="18dp"
android:text="Your Minor Personality no:" />
<TextView
android:id="@+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView19"
android:layout_alignLeft="@+id/textView17"
android:text="TextView" />
<TextView
android:id="@+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView19"
android:layout_below="@+id/textView19"
android:layout_marginTop="18dp"
android:text="Your result is loading....." />
</RelativeLayout>
</ScrollView>
</LinearLayout>
Normally, the system and app cache helps your device load apps and processes faster. However, it might get corrupted during system changes, causing your device to lag, freeze, or be unable to scroll. In that case, we recommend you wipe the Android cache partition on your phone to fix the problem.
NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.
Attributes Of Scroll View: ScrollView and HorizontalScrollView has same attributes, the only difference is scrollView scroll the child items in vertical direction while horizontal scroll view scroll the child items in horizontal direction.
You have used fill parent for your Scrollview height layout Use android:layout_height="wrap_content" for scrollview
And i am sugesting to use LinearLayout with vertical orientation layout for this kind of use
Remove RelativeLayout with id "header901", it is useless, you can just leave headertext901 withe the main LinearLayout as parent ...
Then remove the following tags from SCrollView :
android:scrollbars="vertical"
android:fillViewport="true"
I would also advise to replace your RelativeLayout with id "lLayout901" by a LinearLayout, and follow @Martin Marconcini's advice to replace fill_parent with match_parent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With