Android ScrollView未向下滚动
我知道这是一个非常基本的问题。我还是解决不了。我在标题视图下面有一个滚动视图,而滚动视图根本不滚动。我将在下面发布我的代码。请看一看Android ScrollView未向下滚动,android,android-scrollview,Android,Android Scrollview,我知道这是一个非常基本的问题。我还是解决不了。我在标题视图下面有一个滚动视图,而滚动视图根本不滚动。我将在下面发布我的代码。请看一看 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fi
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/page_background"
android:clickable="true"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:gravity="center_vertical"
android:layout_weight="0"
android:clickable="true"
android:background="@color/button_colour">
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="14"
android:padding="2dp"
android:clickable="true"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
</LinearLayout>
在这种情况下,android:layout\u weight没有任何用处。而且您也不必在
ScrollView
内部使用android:layout\u weight
。如果使用视图
将被包装在视图组中
并且不会滚动。而fill\u parent
是去润滑的,使用match\u parent
使用以下布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:clickable="true"
android:gravity="center_vertical">
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
android:orientation="vertical"
android:padding="2dp"
>
<!--Other views goes here without weight-->
</LinearLayout>
</ScrollView>
</LinearLayout>
家长可能正在使用click,为了进行测试,请尝试从家长删除
android:clickable=“true”
。