Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.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_View_Scrollview_Android Linearlayout_Off Screen - Fatal编程技术网

Android 线性布局或滚动视图被推离屏幕

Android 线性布局或滚动视图被推离屏幕,android,view,scrollview,android-linearlayout,off-screen,Android,View,Scrollview,Android Linearlayout,Off Screen,由于某些原因,scrollview被从屏幕上推出 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_new_male_female_sf" android:layout_width="match_parent" android:layout_height=

由于某些原因,scrollview被从屏幕上推出

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_new_male_female_sf"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >

<RelativeLayout
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="2" >

    <RelativeLayout
        android:id="@+id/rel_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

     //DYNAMICALLY PUTTING IMAGEVIEW HERE   

    </RelativeLayout>

    <Button
        android:id="@+id/next_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

<ScrollView
    android:id="@+id/scrollview"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="3" >

    <LinearLayout
        android:id="@+id/selection_bar"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

    </LinearLayout>

</ScrollView>

</LinearLayout>

//动态地将IMAGEVIEW放在这里

我已经尝试将最外层的布局设置为相对布局,但是scrollview与嵌套的相对布局重叠。有人能提供建议吗?

这不起作用,因为您使用匹配父项作为高度,所以
相对长度占去了所有空间。当总和大于线性布局时,权重用于分配剩余的空白空间或带走空间


改为将宽度设置为0dp,它将起作用。:)

我试过了,没用。我只是删除了按钮,一切都正常了。但感谢您的回复,非常感谢!