繁体   English   中英

图片未显示在滚动视图内的android imageview中

[英]Picture not showing in android imageview within scrollview

我有一张大照片,试图让我的用户查看。 我也想在以后在图片上添加按钮,以使他们能够获得有关某些地图点的更多信息。

我的XML如下:

<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scrollbars="none">
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/map_image"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:src="@drawable/map_1280" />

</RelativeLayout>

我将相对布局用作直接子项的原因是为了稍后放置按钮。 我遇到的问题是图像没有显示。 与背景颜色相同。 但是,在获得指示滚动视图结束的辉光之前,我可以左右滚动一点。 但是,我看不到图片。

我还把它添加到了Java中,以防万一:

setContentView(R.layout.map_view);
ImageView mapView = (ImageView)findViewById(R.id.map_image);
mapView.setImageResource(R.drawable.map_1280);

依然没有。 难道我做错了什么? 图像打开良好,没有任何问题。 这是一张2000 * 1280的大图片,在其他情况下也可以打开。

有几种方法可以做到这一点。 以下链接可以为您提供帮助。 链接1 链接2 链接3

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM