问题描述:fragmentActivity中有一个viewpager,viewpager中Item是fragment,其中一个fragment中有一个ScrollView,当fragment之间切换的时候,回到带有scrollview的fragment的时候,发现scrollview中内容发生了滚动,怎么解决呢?
解决方案 :
在scrollview的第一个子布局添加几个属性(用数字标记的) , :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true" // 1
android:focusableInTouchMode="true" //2
android:descendantFocusability="beforeDescendants" // 3
参考博文:http://meiyitianabc.blog.163.com/blog/static/105022127201381722225421/