2015-12-17 23 views
0
<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="250dp" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="50dp" 
    android:layout_marginRight="50dp" 
    android:layout_marginTop="10dp" 
     >  
    <ImageView 
     android:id="@+id/image" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"  
     /> 

</RelativeLayout> 

图片警示图片视图:如何提高图像的大小完全在机器人

public void imagealert(int position) { 
     final Dialog dialog = new Dialog(mcontext); 
     dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     dialog.getWindow() 
       .setSoftInputMode(
         WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE 
           | WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
     dialog.setContentView(R.layout.imagepopulayout); 
     ImageView image = (ImageView) dialog.findViewById(R.id.image); 
     String imgae = dbManager.GetimageUrl(datamodel.get(position).getProdcutid()); 
     String imageUrl = "http://bhaskarmart.com/Images/" + imgae; 
     Picasso.with(mcontext).load(imageUrl).into(image); 
     dialog.show(); 
    } 

使用此代码我是在对话框ImageView的显示图像,我想显示在图片查看完整图片全,但我无法尽请建议我怎么会交流香葱这下面是我的屏幕:

enter image description here

+0

从您的''的RelativeLayout为什么 – Mohit

+0

一个对话框,在保证金?你知道那个图书馆吗? https://github.com/chrisbanes/PhotoView可以放大/缩小,使用起来非常简单,也许是更好的选择。 – Aspicas

回答

3

对于您需要添加更多的属性图片查看整个图像视图占据图像:

android:scaleType="fitXY" 

您在XML中的ImageView

<ImageView 
    android:id="@+id/image" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:scaleType="fitXY" /> 
+0

高度增加但宽度不是? –

0

使用这个属性在你的ImageView。

android:scaleType="fitXY" 
0

您可以使用fitXY

将x和y尺寸缩放到与视图尺寸完全一致;不保持图像宽高比。

android:scaleType="fitXY" 

检查演示ImageView scaleType Samples

相关问题