0

Can anyone help me with this piece of xml code here is a print screen: http://flic.kr/p/fKEqmn

Here is my xml code:

    <ScrollView
    android:id="@+id/scrollView1"
    android:layout_marginTop="40dp"

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

   <LinearLayout
   android:id="@+id/LinearLayoutmain"
    android:clipToPadding="true"
   android:layout_width="fill_parent"
   android:layout_height="match_parent"
   android:layout_marginTop="10dp"
   android:orientation="vertical"
   android:scaleType="fitXY" >

    <LinearLayout
    android:id="@+id/LinearLayout01"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginTop="10dp"
    android:orientation="vertical" >

        <ImageButton
        android:id="@+id/pd"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="60dp"
        android:onClick="pod"
        android:scaleType="fitXY"
        android:src="@drawable/podcast" />

        <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.Podcast section is where students can access voice   " />

        <ImageButton
        android:id="@+id/an"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="50dp"
        android:onClick="announce"
        android:scaleType="fitXY"
        android:src="@drawable/announce" />

         <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.News section contains announcements posted by instructors" />

        <ImageButton
        android:id="@+id/ex"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="50dp"
        android:onClick="eksam"
        android:scaleType="fitXY"
        android:src="@drawable/exam" />

         <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.Exam section contains the schedule of examinations" />

        <ImageButton
        android:id="@+id/kl"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="50dp"
        android:onClick="kalendaryo"
        android:scaleType="fitXY"
        android:src="@drawable/calendar" />

        <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.Calendar section has the schedule of different University " />

        <ImageButton
        android:id="@+id/cl"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="50dp"
        android:onClick="klas"
        android:scaleType="fitXY"
        android:src="@drawable/klase" />

        <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.Class section contains the users different class schedules" />

       <ImageButton
        android:id="@+id/gr"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="50dp"
        android:onClick="grupo"
        android:scaleType="fitXY"
        android:src="@drawable/group" />

        <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.Groups section lists all the groups that the user belongs"  />

        <ImageButton
         android:id="@+id/lc"
         android:layout_width="50dp"
         android:layout_height="wrap_content"
         android:layout_marginLeft="110dp"
         android:layout_marginRight="20dp"
         android:layout_marginTop="10dp"
         android:adjustViewBounds="true"
         android:background="@null"
         android:maxHeight="30dp"
         android:maxWidth="50dp"
         android:onClick="lectures"
         android:scaleType="fitXY"
         android:src="@drawable/lec" />

        <TextView
         android:id="@+id/textView7"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="10dp"
         android:text="My.Lectureshare contains files that were posted by the       />

        <ImageButton
         android:id="@+id/post"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:adjustViewBounds="true"
        android:background="@null"
        android:maxHeight="30dp"
        android:maxWidth="50dp"
        android:onClick="lecpost"
        android:scaleType="fitXY"
        android:src="@drawable/post" />

     <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="My.Post is were instructors are capable to post files  class" />

     </LinearLayout>





      </LinearLayout>


     </ScrollView>

So basically I want the linearlayout to fit inside its parent scroll view.. I already set its height to match_parent but still it goes out of bounds

Chad
  • 35
  • 1
  • 2
  • 11
  • Still doesn't work @SKT – Chad Sep 06 '13 at 10:00
  • Still doesnt work @shiju B – Chad Sep 06 '13 at 10:05
  • The purpose of a `ScrollView` is to give its child how much space it would possible want. If you need to make the child `LinearLayout` be as big as the screen then remove the `ScrollView` or set the height of the `LinearLayout to be exactly the height of the screen. – user Sep 06 '13 at 10:07
  • @Luksprog here is a screenshot of what it looks like flickr.com/photos/64167089@N03/9683198109 even though its scrollable it looks like this when I scrolled down – Chad Sep 06 '13 at 10:33
  • @Chad I copy pasted your layout and tried it. It looks fine to me and scales till the bottom of the window. Can you try with android:fillViewport="true" in the scrollview tag. – prijupaul Sep 06 '13 at 11:47

2 Answers2

0

A scrollview is designed to have content that exceeds the height of the screen, thus making it scrollable. I assume that is why you use a scrollview in the first place.

If you want to be able to see all of your child LinearLayout in your designer, you can change the device view from Nexus S (which it is set to in your screenshot) and choose for instance a 10.1 tablet view. This will not affect how the design looks on your phone, it will just give you more screen space to design on.

Daniel
  • 924
  • 1
  • 14
  • 31
  • here is a screenshot of what it looks like flickr.com/photos/64167089@N03/9683198109 even though its scrollable it looks like this when I scrolled down – Chad Sep 06 '13 at 10:34
0
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="5dp" >

    <LinearLayout
        android:id="@+id/LinearLayout01"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical" >

        <ImageButton
            android:id="@+id/pd"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="60dp"
            android:onClick="pod"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.Podcast section is where students can access voice   " />

        <ImageButton
            android:id="@+id/an"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="announce"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.News section contains announcements posted by instructors" />

        <ImageButton
            android:id="@+id/ex"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="eksam"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.Exam section contains the schedule of examinations" />

        <ImageButton
            android:id="@+id/kl"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="kalendaryo"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.Calendar section has the schedule of different University " />

        <ImageButton
            android:id="@+id/cl"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="klas"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.Class section contains the users different class schedules" />

        <ImageButton
            android:id="@+id/gr"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="grupo"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.Groups section lists all the groups that the user belongs" />

        <ImageButton
            android:id="@+id/lc"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="lectures"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView7"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:onClick="lecpost"
            android:text="My.Lectureshare contains files that were posted by the" />

        <ImageButton
            android:id="@+id/post"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:adjustViewBounds="true"
            android:maxHeight="30dp"
            android:maxWidth="50dp"
            android:onClick="lecpost"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView8"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:text="My.Post is were instructors are capable to post files  class" />
    </LinearLayout>

</ScrollView>

// this my out put
![enter image description here][1]
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67
  • Sir I've tried the code you've modified but when I've runned the application the scrollview doesnt allow me to scroll until the last textview which is textview8 – Chad Sep 06 '13 at 11:07