我在scrollview内使用HorizontalScrollView来实现图片放大后的水平和纵向滚动
滚动效果是实现了
可是有个问题就是一次只能滚动一个方向
也就是说我触摸屏幕做纵向滚动后,手不离开屏幕,这时要再横向滚动就没办法滚动了
我有看到其他应用是可以同时双向滚动的
不知道是怎么实现的呢?
以下是我的部分代码:<ScrollView android:id="@+id/ScrollViewDetail"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:fillViewport="true"
android:fadingEdge="none" android:scrollbarSize="0dip"
android:layout_gravity="center">
<HorizontalScrollView android:id="@+id/scrollImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fadingEdge="none" android:scrollbarSize="0dip" android:scrollbarAlwaysDrawHorizontalTrack="true">
<LinearLayout androidrientation="vertical" android:gravity="center"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/ImageDetail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:tag="imageDetail" android:scaleType="fitCenter"
android:layout_gravity="center"
android:layout_weight="1" android:padding="0dip" android:layout_margin="0dip">
</ImageView>
</LinearLayout>
</HorizontalScrollView>
</ScrollView>
滚动效果是实现了
可是有个问题就是一次只能滚动一个方向
也就是说我触摸屏幕做纵向滚动后,手不离开屏幕,这时要再横向滚动就没办法滚动了
我有看到其他应用是可以同时双向滚动的
不知道是怎么实现的呢?
以下是我的部分代码:<ScrollView android:id="@+id/ScrollViewDetail"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:fillViewport="true"
android:fadingEdge="none" android:scrollbarSize="0dip"
android:layout_gravity="center">
<HorizontalScrollView android:id="@+id/scrollImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fadingEdge="none" android:scrollbarSize="0dip" android:scrollbarAlwaysDrawHorizontalTrack="true">
<LinearLayout androidrientation="vertical" android:gravity="center"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/ImageDetail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:tag="imageDetail" android:scaleType="fitCenter"
android:layout_gravity="center"
android:layout_weight="1" android:padding="0dip" android:layout_margin="0dip">
</ImageView>
</LinearLayout>
</HorizontalScrollView>
</ScrollView>
解决方案 »
- android sqlite ROW问题
- android上要做一个电子说明书,格式问题上有没有什么好的方案啊,试过解析xml文件,用浏览器来读,可是都是乱码,各位有没有什么方案
- android 中用poi打开doc文件报错
- SimpleAdapter的setAdapter()失败,logcat找不到原因,求大神!!!
- Android 自定义地图
- 想实现一个功能,求思路
- cocos2d-x安卓游戏开发.兄弟们介绍一款测试机吧.模拟器太慢,受不了.
- 请问anroid怎么播放aac文件。
- android 微信 第三方法登陆如何获取code
- Android Studio 出现Session ‘app’: Error Installing APKs
- Eclipse adt在线安装问题
- listView中应用imageButton
实现比较烂,但是能用。