Scroll in the relative layout

Put your problem here if it does not fit any of the other categories.

Scroll in the relative layout

Postby crayder » Mon Feb 18, 2008 2:35 pm

Hello! I have tried to create relative layout and put there one by one several text fields. The problem is that summary height of these fields is higher than height of the screen and I can't see something like scrollbar for this activity.
Here are layout attributes:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.  
  4.                android:layout_width="fill_parent"
  5.  
  6.                android:layout_height="fill_parent"
  7.  
  8.                android:padding="10px">
  9.  
  10.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Could you please say me how to manage many text fields on the screen?
crayder
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 04, 2008 12:35 am

Top

Postby arnouf » Mon Feb 18, 2008 7:55 pm

I've the same problem with a linear layout for I upgraded my SDK version to m5 :(

All was ok with m3 and m4 and now all my apps is blocked by this.

Does somebody have an idea?

regards
arnouf
Developer
Developer
 
Posts: 28
Joined: Mon Jan 21, 2008 9:07 pm

Postby arnouf » Mon Feb 18, 2008 9:36 pm

the solution

Add a global scrollview
arnouf
Developer
Developer
 
Posts: 28
Joined: Mon Jan 21, 2008 9:07 pm

Postby crayder » Mon Feb 18, 2008 10:11 pm

Sorry arnouf
Could you please say more exactly where global scroll bar can be added?
crayder
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 04, 2008 12:35 am

Postby arnouf » Mon Feb 18, 2008 10:15 pm

ok

In your layout xml file, I think that you have a principal layout containing your view.
Ex. :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
....

Just after this tag, add a scrollview component:
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">

And don't forget to close it at the end of your layout file.

Arnaud
arnouf
Developer
Developer
 
Posts: 28
Joined: Mon Jan 21, 2008 9:07 pm

Postby crayder » Mon Feb 18, 2008 11:11 pm

I have tried to do this way:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2.  
  3.                android:layout_width="fill_parent"
  4.  
  5.                android:layout_height="fill_parent"
  6.  
  7.                android:padding="10px">
  8.  
  9. <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
  10.  
  11.     <TextView
  12.  
  13.         android:id="@+id/name_label"
  14.  
  15.        android:layout_width="wrap_content"
  16.  
  17.        android:layout_height="wrap_content"
  18.  
  19.        android:layout_alignParentLeft="true"
  20.  
  21.        android:text="@string/name"/>
  22.  
  23.         <EditText
  24.  
  25.                 android:id="@+id/name"
  26.  
  27.                 android:maxLines="1"
  28.  
  29.                 android:singleLine="true"
  30.  
  31.                 android:layout_width="fill_parent"
  32.  
  33.                 android:layout_height="wrap_content"
  34.  
  35.                 android:layout_below="@+id/name_label">
  36.  
  37.                 <requestFocus/>
  38.  
  39.         </EditText>
  40.  
  41.         <TextView
  42.  
  43.                 android:id="@+id/description_label"
  44.  
  45.        android:layout_width="wrap_content"
  46.  
  47.        android:layout_height="wrap_content"
  48.  
  49.        android:layout_alignParentLeft="true"
  50.  
  51.        android:text="@string/description"
  52.  
  53.        android:layout_below="@+id/name"/>
  54.  
  55.         <EditText
  56.  
  57.                 android:id="@+id/description"
  58.  
  59.                 android:lines="5"
  60.  
  61.                 android:singleLine="false"
  62.  
  63.                 android:autoLink="web"
  64.  
  65.                 android:autoText="true"
  66.  
  67.                 android:layout_width="fill_parent"
  68.  
  69.                 android:layout_height="wrap_content"
  70.  
  71.                 android:layout_below="@+id/description_label">
  72.  
  73.         </EditText>
  74.  
  75. </ScrollView>
  76.  
  77. </RelativeLayout>
Parsed in 0.005 seconds, using GeSHi 1.0.8.4


The result is no scrollbars, all the fields now are not one by one, they all are "gathered" now in the left upper corner.
crayder
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 04, 2008 12:35 am

Top

Postby arnouf » Tue Feb 19, 2008 9:51 am

try to add a LinearLayout replacing your RelativeLayout and place your relativelayout after the scrollview...
something like this

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.  
  4.                android:layout_width="fill_parent"
  5.  
  6.                android:layout_height="fill_parent"
  7.  
  8.                android:padding="10px">
  9.  
  10. <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
  11.  
  12. <RelativeLayout......>
  13.  
  14. Your content here: textview and other components
  15.  
  16. </RelativeLayout>
  17.  
  18. </ScrollView>
  19.  
  20. </LinearLayout>
  21.  
  22.  
  23.  
  24.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

Thanks for your feedback
arnouf
Developer
Developer
 
Posts: 28
Joined: Mon Jan 21, 2008 9:07 pm

Postby crayder » Wed Feb 20, 2008 1:46 am

bingo!!! it works ))) thank you very much ))
crayder
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 04, 2008 12:35 am

Postby arnouf » Wed Feb 20, 2008 9:28 am

I'm happy to have help you :)
arnouf
Developer
Developer
 
Posts: 28
Joined: Mon Jan 21, 2008 9:07 pm

How to add a horizontal scroll bar to the scroll view

Postby akil » Fri Mar 14, 2008 6:19 am

Hi,

I have a table layout inside my scroll view.So i should have a horizontal scroll bar to view all columns.some body tell me how to add a horizontal scroll bar to it.
akil
Freshman
Freshman
 
Posts: 6
Joined: Wed Feb 27, 2008 5:19 am

Re: How to add a horizontal scroll bar to the scroll view

Postby arnouf » Fri Mar 14, 2008 9:11 am

akil wrote:Hi,

I have a table layout inside my scroll view.So i should have a horizontal scroll bar to view all columns.some body tell me how to add a horizontal scroll bar to it.


Did you try try to create a scrollview setting the different scrollbar (horizontal for you apparently) and add in it your tablelayout?
Or create a scrollview, set a LinearLayout in it containing itself a tablelayout?

It's maybe some way to do that you wish.
arnouf
Developer
Developer
 
Posts: 28
Joined: Mon Jan 21, 2008 9:07 pm

Hi

Postby akil » Mon Mar 17, 2008 6:04 am

Hi..i tried setting the sethorizontal scrollbar(true) but no use...the scroll bar is not visible.
akil
Freshman
Freshman
 
Posts: 6
Joined: Wed Feb 27, 2008 5:19 am

Postby sujay » Mon Sep 14, 2009 4:05 pm

Hi arnouf,
do u mean to say that the hierarchy needs to be
scrollview->Linearlayout->tablelayout???
sujay
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed May 20, 2009 11:01 am

Postby sujay » Mon Sep 14, 2009 4:10 pm

Hi akil,
have u found a solution for this problem??
If u find any plz let me no. 'm also facing a similar issue.
sujay
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed May 20, 2009 11:01 am

Re: Scroll in the relative layout

Postby Sankari11 » Thu Sep 08, 2011 10:18 am

Hey arnouf thank you very much..
Sankari11
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Sep 08, 2011 10:17 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 13 guests