0

I have a scroll view:

<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <LinearLayout android:layout_width="500dp" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/antiquewhiter" android:weightSum="100" > <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="10" android:background="@drawable/green_gradient_top_bar" > <TextView android:id="@+id/log_in_header_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/Einloggen_text" style="@style/headerfromdialogs" /> <ImageView android:id="@+id/log_in_header_exit_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/log_in_header_text" android:layout_alignParentRight="true" android:layout_marginRight="20dp" android:onClick="finish" android:src="@drawable/x_android" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="90" > <TextView android:id="@+id/log_in_benutzername_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="40dp" android:layout_marginTop="80dp" android:text="@string/Benutzername_text" style="@style/dialogsGreenTexts" /> <EditText android:id="@+id/log_in_benutzername_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/log_in_benutzername_text" android:layout_alignBottom="@+id/log_in_benutzername_text" android:layout_marginLeft="50dp" android:layout_marginRight="20dp" android:layout_toRightOf="@+id/log_in_benutzername_text" android:ems="10" android:hint="@string/hint_name_log_in" > </EditText> <TextView android:id="@+id/log_in_passwort_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/log_in_benutzername_text" android:layout_below="@+id/log_in_benutzername_edit_text" android:layout_marginTop="52dp" android:text="@string/Passwort_text" style="@style/dialogsGreenTexts" /> <EditText android:id="@+id/log_in_passwort_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/log_in_passwort_text" android:layout_alignBottom="@+id/log_in_passwort_text" android:layout_alignLeft="@+id/log_in_benutzername_edit_text" android:ems="10" android:layout_marginRight="20dp" android:inputType="textPassword" android:hint="@string/hint_passwort_log_in" > </EditText> <Button android:id="@+id/log_in_button" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignRight="@+id/log_in_passwort_edit_text" android:layout_marginBottom="45dp" android:layout_marginRight="-10dp" android:onClick="logIn" android:text="@string/Login_text" style="@style/bold_text18" /> <!-- android:background="@drawable/green_gradient_button" --> <TextView android:id="@+id/log_in_passwort_vergessen_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/log_in_button" android:layout_alignLeft="@+id/log_in_passwort_edit_text" android:text="@string/Passwort_vergessen_text" style="@style/dialogsGreenTexts" /> <ProgressBar android:id="@+id/waitProgessBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:visibility="gone" /> <TextView android:id="@+id/userError" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/log_in_benutzername_edit_text" android:layout_alignLeft="@+id/log_in_benutzername_edit_text" android:layout_marginBottom="5dp" android:visibility="gone" android:textColor="@color/errorRed"/> </RelativeLayout> </LinearLayout> </ScrollView> 

I want to scroll because on my se xperia neo V in horizontal orientation I can't see all view. Second problem is when I change orientation all view is broke. How change this view to show properly in both orientations?

but scroll doesn't work. Anyone know Why?

3
  • Is your layout more than large as compare to screen ? if yes then and then scroll view come . Commented Oct 26, 2012 at 6:43
  • What are the child views you are having inside the layout, ask clearly... Commented Oct 26, 2012 at 6:44
  • What do you want scroll ? Provide detailed code so that you can get correct response, depending on what you want to scroll Commented Oct 26, 2012 at 6:45

2 Answers 2

2

Please note :

1) Scroll view must have a single child (i.e all views must be included within a single root layout inside scroll view)

2) ScrollView works when your page size is greater the default height of the screen .

Please check both these things and if still does not work ... Paste some code to have a better understanding of the problem.

Sign up to request clarification or add additional context in comments.

Comments

1

try this code

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="500dp" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/antiquewhiter" android:weightSum="100" > <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="10" android:background="@drawable/green_gradient_top_bar" > <TextView android:id="@+id/log_in_header_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/Einloggen_text" style="@style/headerfromdialogs" /> <ImageView android:id="@+id/log_in_header_exit_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/log_in_header_text" android:layout_alignParentRight="true" android:layout_marginRight="20dp" android:onClick="finish" android:src="@drawable/x_android" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="90" > <TextView android:id="@+id/log_in_benutzername_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="40dp" android:layout_marginTop="80dp" android:text="@string/Benutzername_text" style="@style/dialogsGreenTexts" /> <EditText android:id="@+id/log_in_benutzername_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/log_in_benutzername_text" android:layout_alignBottom="@+id/log_in_benutzername_text" android:layout_marginLeft="50dp" android:layout_marginRight="20dp" android:layout_toRightOf="@+id/log_in_benutzername_text" android:ems="10" android:hint="@string/hint_name_log_in" > </EditText> <TextView android:id="@+id/log_in_passwort_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/log_in_benutzername_text" android:layout_below="@+id/log_in_benutzername_edit_text" android:layout_marginTop="52dp" android:text="@string/Passwort_text" style="@style/dialogsGreenTexts" /> <EditText android:id="@+id/log_in_passwort_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/log_in_passwort_text" android:layout_alignBottom="@+id/log_in_passwort_text" android:layout_alignLeft="@+id/log_in_benutzername_edit_text" android:ems="10" android:layout_marginRight="20dp" android:inputType="textPassword" android:hint="@string/hint_passwort_log_in" > </EditText> <Button android:id="@+id/log_in_button" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignRight="@+id/log_in_passwort_edit_text" android:layout_marginBottom="45dp" android:layout_marginRight="-10dp" android:onClick="logIn" android:text="@string/Login_text" style="@style/bold_text18" /> <!-- android:background="@drawable/green_gradient_button" --> <TextView android:id="@+id/log_in_passwort_vergessen_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/log_in_button" android:layout_alignLeft="@+id/log_in_passwort_edit_text" android:text="@string/Passwort_vergessen_text" style="@style/dialogsGreenTexts" /> <ProgressBar android:id="@+id/waitProgessBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:visibility="gone" /> <TextView android:id="@+id/userError" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/log_in_benutzername_edit_text" android:layout_alignLeft="@+id/log_in_benutzername_edit_text" android:layout_marginBottom="5dp" android:visibility="gone" android:textColor="@color/errorRed"/> </RelativeLayout> </LinearLayout> </ScrollView> </LinearLayout> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.