滚动视图不布置工作 [英] Scroll view doesn't work in layout
问题描述
我有一个滚动视图:
<?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>
我要滚动,因为在水平方向我不能看到所有观点我SE XPERIA新诉第二个问题是,当我改变方向所有的观点是破产了。如何改变这种观点在两个方向正确显示?
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?
推荐答案
请注意:
1)滚动视图必须有一个孩子(即所有的意见都必须包含滚动视图内的单根布局内)
1) Scroll view must have a single child (i.e all views must be included within a single root layout inside scroll view)
2)滚动型的作品时,你的页面尺寸更大屏幕的默认高度。
2) ScrollView works when your page size is greater the default height of the screen .
请检查这两个东西,如果仍然无法正常工作...粘贴一些code到有更好的理解这个问题。
Please check both these things and if still does not work ... Paste some code to have a better understanding of the problem.
这篇关于滚动视图不布置工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!