2012-09-13 55 views
1

我有一个大图片,我试图让我的用户查看。我还希望在以后的日期中在图片上添加按钮,以便他们获得有关某些地图点的更多信息。图片没有显示在android imageview内滚动视图

我的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图片,并且在其他方​​面很好。

回答