Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - image view inside view pager issues
    primarykey
    data
    text
    <p>I have an image view inside view pager to display some images coming from url as shown in the screen shot below, </p> <p><img src="https://i.stack.imgur.com/TI37O.jpg" alt="enter image description here"> However, the image should be filled( should occupy the complete view pager space). But what is happening in my case is the image is displayed in center even though when i set layout params to fill parent.</p> <p>my fragment where i return layout with image view:</p> <pre><code>ImageView image = new ImageView(getActivity()); ImageLoader imgLoader = new ImageLoader(MainActivity.context); imgLoader.DisplayImage(imagePath, new Activity(), image); LinearLayout layout = new LinearLayout(getActivity()); layout.setLayoutParams(new LayoutParams()); layout.setGravity(Gravity.CENTER); layout.addView(image); return layout; </code></pre> <p>view pager:</p> <pre><code>&lt;LinearLayout android:layout_width="match_parent" android:layout_height="225dp" android:background="@color/white" android:orientation="vertical" &gt; &lt;android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>when the image is still loading from url i ll show some progress like animation and once loaded i will set the image inside imageview</p> <pre><code>if (bitmap != null) { imageView.setBackgroundResource(0); imageView.setImageBitmap(bitmap); } else { imageView.setBackgroundResource(R.drawable.view_pager_progress); final AnimationDrawable startAnimation = (AnimationDrawable) imageView .getBackground(); imageView.setScaleType(ScaleType.CENTER);// i tried FIT_XY, dint work startAnimation.start(); } </code></pre> <p>To summarize, what i want is, the image inside view pager should fill the complete space inside view pager both horizontally and vertically. Any idea how to do this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload