【问题标题】:ImageView not displaying inside of HorizontalScrollView in androidImageView不显示在android中的Horizo​​ntalScrollView内部
【发布时间】:2013-03-05 12:19:14
【问题描述】:

我有一个 8000 像素长的图像,我想水平滚动。当我将图像作为 ImageView 插入到 Horizo​​ntalScrollView 并在物理设备(Samsung galaxy nexus)上运行时,滚动条提示图像已加载,但没有显示图像。一切都在 android xml 查看器中正确显示。 这是我的水平滚动视图的 xml:

<HorizontalScrollView
    android:id="@+id/horizontalScrollView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/TableRow01"
    android:scrollbars="horizontal" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="14dp"
            android:src="@drawable/longimage" />
    </LinearLayout>

</HorizontalScrollView>

我已尝试将图像包装在其他几种布局中并单独包装,但在设备上没有任何效果。提前致谢。

【问题讨论】:

  • 尝试一些小图像,你确定你没有收到任何崩溃日志吗?
  • 啊,谢谢!有一个崩溃日志:位图太大,无法作为纹理上传。那我怎么上传图片呢?

标签: android imageview scrollview horizontalscrollview


【解决方案1】:

您可以将 imageView 的参数更改为 match_parent。

【讨论】:

    猜你喜欢
    • 2021-07-02
    • 1970-01-01
    • 2011-06-16
    • 2018-06-20
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多