代码之家  ›  专栏  ›  技术社区  ›  irl_irl

如何使图像可滚动?[安卓平台]

  •  2
  • irl_irl  · 技术社区  · 16 年前

    我有一个图像比Android屏幕占用更多的空间。我希望图像显示为全尺寸,用户可以向任何方向移动。就像一张地图。

    有什么建议吗?

    4 回复  |  直到 7 年前
        1
  •  1
  •   James Moore    16 年前

    这是我看到的一个教程,它完成了你所描述的 http://www.anddev.org/scrolling_a_picture_horizontally_and_vertically-t3245.html

        2
  •  3
  •   JRL    16 年前

    您可以使用免费提供给您的WebView。我不知道为什么,但当我尝试 使用loadData方法时,它不起作用,但使用了loadDataWithBaseURL和空URL。

    使用WebView,您的图像甚至可以嵌入到HTML中。在下面的示例中 yourContent 只是一个字符串。

    例如。

    yourView.loadDataWithBaseURL(null, yourContent, "text/html", "UTF-8", null);
    
        3
  •  0
  •   thinuwan    8 年前

    你可以把你的图像放在 图片框 然后用一个 卷轴视图 和A 视图 像下面一样。

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/yourImage"/>
    
        </ScrollView>
    
    </HorizontalScrollView>
    

    所以你可以像地图一样水平和垂直滚动它。

        4
  •  -1
  •   user2583792    11 年前

    尝试使用图像将滚动放到XML布局中

    推荐文章