Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 滚动视图不显示';我不能在布局中工作_Android_Android Layout - Fatal编程技术网

Android 滚动视图不显示';我不能在布局中工作

Android 滚动视图不显示';我不能在布局中工作,android,android-layout,Android,Android 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" > &

我有一个滚动视图:

<?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 neo V上,我看不到所有视图。第二个问题是,当我改变方向时,所有视图都被破坏了。如何更改此视图以在两个方向上正确显示


但滚动不起作用。有人知道为什么吗

请注意:

1) 滚动视图必须有一个子视图(即所有视图必须包含在滚动视图内的单个根布局中)

2) 当页面大小大于屏幕的默认高度时,ScrollView工作


请检查这两件事,如果仍然不起作用。。。粘贴一些代码以更好地了解问题。

请注意:

1) 滚动视图必须有一个子视图(即所有视图必须包含在滚动视图内的单个根布局中)

2) 当页面大小大于屏幕的默认高度时,ScrollView工作

请检查这两件事,如果仍然不起作用。。。粘贴一些代码以更好地了解问题。

尝试此代码

<?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>

试试这段代码

<?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>


与屏幕相比,您的布局是否更大?如果是,然后滚动查看。布局中有哪些子视图,请明确询问…您想要滚动什么?提供详细的代码,以便您能够得到正确的响应,这取决于您想要滚动的内容。您的布局是否比屏幕大?如果是,然后滚动查看。布局中有哪些子视图,请明确询问…您想要滚动什么?提供详细的代码,以便根据您想要滚动的内容获得正确的响应