Research Development
Research Development

Reputation: 904

how to increase image Size full to Image view in android

<?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>

Image Alert:

 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();
    }

Using this code i am display image in Imageview on Dialog i want display full image full in Image view but i am unable to do please suggest me how i ll ac-chive this below is my screen :

enter image description here

Upvotes: 0

Views: 437

Answers (3)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

You can use fitXY

Scales the x and y dimensions to exactly match the view size; does not maintain the image aspect ratio.

android:scaleType="fitXY"

Check Demo ImageView scaleType Samples

Upvotes: 0

Ravi Jaggarapu
Ravi Jaggarapu

Reputation: 627

For occupying image with Entire Image view you need to add one more property for Image view is:

 android:scaleType="fitXY"

your ImageView in xml

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

Upvotes: 3

Chandrakant Dvivedi
Chandrakant Dvivedi

Reputation: 663

Use this property in your ImageView.

android:scaleType="fitXY"

Upvotes: 0

Related Questions