Android散打之ScrollView
2016-07-12 16:45
344 查看
scrollview 设置paddingTop后,滑动scrollview时,内容不能显示完全,会被padding给遮挡住。
解决: 设置android:clipToPadding = false;
使用DrawerLayout时,若显示的主区域内容包含scrollview时而抽屉的内容区域没有listview或者scrollview,在抽屉打开后,在抽屉上下滑动时,会将上下滑动事件传递给主区域scrollview导致scrollview会上下滑动,这显然不是我们所期望的。解决方法是将抽屉内容包裹在一个scrollview中,这样就不会滑动主区域的scrollview了。
解决: 设置android:clipToPadding = false;
<ScrollView android:id="@+id/scrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_paddingTop="280dp" android:clipToPadding="false" </ScrollView>
使用DrawerLayout时,若显示的主区域内容包含scrollview时而抽屉的内容区域没有listview或者scrollview,在抽屉打开后,在抽屉上下滑动时,会将上下滑动事件传递给主区域scrollview导致scrollview会上下滑动,这显然不是我们所期望的。解决方法是将抽屉内容包裹在一个scrollview中,这样就不会滑动主区域的scrollview了。
<android.support.v4.widget.DrawerLayout ... ... > <!--主区域内容--> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar android:id="@+id/app_bar" android:layout_width="match_parent" android:layout_height="?actionBarSize" app:contentInsetStart="12dp" app:layout_collapseMode="pin" /> <ScrollView android:id="@+id/scrollView" android:layout_below="@id/app_bar" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/scroll_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> </LinearLayout> </ScrollView> </RelativeLayout> <!--抽屉的内容--> <ScrollView android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="end" android:background="@color/colorTranslucence"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="centerInside" android:src="@drawable/ic_login_poster"/> </RelativeLayout> </ScrollView> </android.support.v4.widget.DrawerLayout>
相关文章推荐
- Android自定义控件:仿美团下拉菜单及相关代码优化
- Android 异步消息处理机制 让你深入理解 Looper、Handler、Message三者关系
- android属性动画与补间动画的区别及用法
- 2K&4K高清播放时代的主流
- Android设置点击可变图片按钮
- android之服务
- [置顶] MPAndroidChart开源图表库,柱状图和折线图CombinedChart
- 读《疯狂Android讲义》之Service运用总结
- Android 中使用Lambda表达式
- Android Studio安装后第一次进不去
- Qt for android QML无法运行问题处理
- Android :Activity中finish() onDestroy() 和System.exit()的区别
- 我的Android进阶之旅------>Java全角半角的转换方法
- 华为手机打开log日志的方法[Android]
- Android---可以实现下拉刷新的ListView
- 在Android中如何使用注解取代Enum
- Android笔记--简单的自定义View之组合模式
- 安卓学习笔记---Android实现页面悬浮显示
- android 通信
- Android 自定义属性