滚动视图折叠嵌套相对布局proplem

时间:2017-06-13 13:13:30

标签: java android xml scrollview

it appers like this 我有这个xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:padding="8dp">


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:id="@+id/layout_comands"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layoutDirection="ltr">

        <TextView
            android:id="@+id/textView_hfccomands"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginBottom="@dimen/activity_horizontal_margin"
            android:text="text " />

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_below="@id/textView_hfccomands"
            app:srcCompat="@drawable/ic_business_index" />

        <TextView
            android:id="@+id/textView_hfc_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/imageView"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_below="@id/textView_hfccomands"
            android:layout_toLeftOf="@id/imageView"
            android:layoutDirection="rtl"
            android:text="text " />


    </RelativeLayout>

    <View
        android:id="@+id/seprator1"
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:layout_below="@id/layout_comands"
        android:layout_marginTop="@dimen/main_screen_bottom_margings"
        android:background="@color/light_blue" />


    <RelativeLayout
        android:id="@+id/layout_lvExpMissions"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/seprator1"
        android:layout_marginTop="@dimen/main_screen_bottom_margings"
        android:background="@color/white">

        <ExpandableListView
            android:id="@+id/lvExphfc_my_missions"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </RelativeLayout>

    <View
        android:id="@+id/seprator2"
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:layout_below="@id/layout_lvExpMissions"
        android:background="@color/light_blue"></View>


    <RelativeLayout
        android:id="@+id/layout_button_help"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/seprator2"
        android:layout_marginTop="@dimen/main_screen_bottom_margings">

        <Button
            android:id="@+id/button_help"
            style="@style/button_custmoized"
            android:layout_width="match_parent"
            android:layout_height="60dp" />

    </RelativeLayout>

    <View
        android:id="@+id/seprator3"
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:layout_below="@id/layout_button_help"
        android:layout_marginTop="@dimen/main_screen_bottom_margings"
        android:background="@color/light_blue"></View>


    <RelativeLayout
        android:id="@+id/layot_emergency_reports"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/seprator3"
        android:layout_marginTop="@dimen/main_screen_bottom_margings"
        android:background="@color/white">

        <ListView
            android:id="@+id/listView_emergencyReports"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </RelativeLayout>

    <View
        android:id="@+id/seprator4"
        android:layout_width="match_parent"
        android:layout_height="8dp"
        android:layout_below="@id/layot_emergency_reports"
        android:layout_marginTop="@dimen/main_screen_bottom_margings"
        android:background="@color/light_blue"></View>

</RelativeLayout>

这个问题是我的滚动视图以某种方式包装内容并且表现得很奇怪! 我只是希望能够滚动整个内容 但滚动视图将相对的窗帘推到屏幕顶部! 我在这里错过了什么

this who it shows if i change my parent scrollview to relativelayout

2 个答案:

答案 0 :(得分:1)

将此代码添加到xml

中的相对布局中
android:focusableInTouchMode="true"

android:visibility="visible"

试试这个

答案 1 :(得分:0)

将此属性添加到xml中的ScrollView

android:fillViewport="true"

它将解决问题。

相关问题