2010-12-10 48 views
1

我有一个图像,我需要它的全视图,因为它是。但加载后手机中显示的图像缩小到适合屏幕。如何以完整大小和分辨率包含图像,以便它可以滚动以查看宽度。如何在完整视图中显示图像

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#EEEEEE" 
> 

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:scrollbars="vertical" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:background="#77aa88"> 

<LinearLayout 

android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:gravity="center" 
android:background="#FFFFFF" 
> 

<TextView android:text="Xkcd" 
     android:textColor="#6E7B91" 
     android:textSize="28dp" 
     android:textScaleX="1.8" 

     android:id="@+id/TextHead" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingTop="10dp" 
     android:paddingBottom="10dp" 
     android:gravity="center" /> 

<TextView android:text="A webcomic of romance, sarcasm, math, and language." 
     android:textColor="#000000" 
     android:textSize="15dp" 
     android:textScaleX="1.1" 

     android:id="@+id/TextSub" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingTop="5dp" 
     android:paddingBottom="10dp" 
     android:gravity="center" /> 
</LinearLayout> 
</ScrollView> 

<ScrollView 
android:scrollbars="horizontal" 
android:layout_height="match_parent" 
android:layout_width="wrap_content"> 

<ImageView android:id="@+id/MainImage" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     /> 


</ScrollView> 
</LinearLayout> 

回答

1

尝试使用矩阵scaleType

<ImageView android:id="@+id/mainimage" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/mainimage" 
      android:scaleType="matrix"/> 
+0

由于dude.Now我可以滚动但仅在垂直方向上。有没有什么办法可以使用水平。在上面的代码中,我已经在scollbars中使用了横向,但是没有发生。请建议 – mohammedsuhail 2010-12-10 13:35:59

+0

尝试在ScrollView中使用fill_parent作为高度。在布局中尝试一点高度。 – kgiannakakis 2010-12-10 14:03:23

+0

你可以告诉为什么无法从网页下载imageview显示JPG图像。它可以与png一起使用。 – mohammedsuhail 2011-01-03 06:33:06