Java 滚动视图在OS 4.1.2上不起作用
我在布局中添加了滚动视图,滚动视图具有高度和宽度匹配父对象的属性,fillViewPort对于滚动视图也是如此,它在其他设备中工作,但在android OS 4.1.2中不工作 布局:Java 滚动视图在OS 4.1.2上不起作用,java,android,android-scrollview,Java,Android,Android Scrollview,我在布局中添加了滚动视图,滚动视图具有高度和宽度匹配父对象的属性,fillViewPort对于滚动视图也是如此,它在其他设备中工作,但在android OS 4.1.2中不工作 布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://s
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:background="@android:color/white"
android:layout_height="match_parent">
<!-- <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!– <ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.5"
android:scaleType="fitXY"
android:src="@drawable/page"/>–>
</RelativeLayout>-->
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="8">
<TextView
android:id="@+id/main_welcome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dimen_20dp"
android:text="@string/welcome"
android:textColor="@color/colorPrimary"
android:textStyle="bold" />
<GridView
android:id="@+id/gridviewMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_40dp"
android:layout_marginLeft="@dimen/dimen_40dp"
android:layout_marginRight="@dimen/dimen_40dp"
android:columnWidth="80dp"
android:horizontalSpacing="@dimen/dimen_10dp"
android:numColumns="2"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp"></GridView>
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_centerInParent="false"
android:text="For Any Queries Related To Mobile App Click On Service Request"
android:textAlignment="center" />
</RelativeLayout>
这是什么原因呢?所有其他滚动视图都在同一设备中工作,只是不在此屏幕上工作
请帮助。谢谢。尝试改用nestedScrollView
<nestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="8">
<TextView
android:id="@+id/main_welcome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dimen_20dp"
android:text="@string/welcome"
android:textColor="@color/colorPrimary"
android:textStyle="bold" />
<GridView
android:id="@+id/gridviewMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_40dp"
android:layout_marginLeft="@dimen/dimen_40dp"
android:layout_marginRight="@dimen/dimen_40dp"
android:columnWidth="80dp"
android:horizontalSpacing="@dimen/dimen_10dp"
android:numColumns="2"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp"></GridView>
</LinearLayout>
</nestedScrollView>
我尝试添加嵌套视图,它给出了二进制充气异常。