[英]Scroll View does not work on OS 4.1.2
I have added scroll view in a layout, scroll view has attributes of match parent for height and width also fillViewPort is true for scroll view, its working in other devices but not working in android OS 4.1.2. 我在布局中添加了滚动视图,滚动视图的高度和宽度具有与父级匹配的属性,对于滚动视图,fillViewPort是true,它在其他设备中有效,但在android OS 4.1.2中不起作用。
Layout : 版面:
<?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>
What can be the reason for this? 这可能是什么原因? All other scroll views are working in same device just not working on this screen.
所有其他滚动视图都在同一设备上工作,只是不在此屏幕上工作。
Please help.Thank you.. 请帮助。谢谢。
Try Using nestedScrollView instead 尝试改用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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.