【发布时间】:2017-06-13 13:13:30
【问题描述】:
<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>
问题是我的滚动视图以某种方式包装内容并表现得很奇怪! 我只想能够向下滚动整个内容 但是滚动视图将相对布局推到屏幕顶部! 我在这里错过了什么
【问题讨论】:
-
行为怪异?添加一些截图
-
是否需要相对布局?尝试使用线性布局。
-
当我用 relativelayout 替换父滚动视图时,您可以在第二张图片中看到
-
@SurendraShrestha 我试过 Linear Lyout 它没有帮助,它隐藏了视图
-
我认为问题在于您在列表视图中有一个列表视图。因此,在尝试滚动列表内的列表时,仅滚动内部列表而不滚动外部列表。这似乎是你的问题。
标签: java android xml scrollview