Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That way you wont see the fling efect.</p> <p>there is one way of doing that with the gallery.</p> <p>clreate the galery like this:</p> <pre><code>&lt;Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/HorizontalGallery" android:gravity="center_vertical" android:spacing="2px"/&gt; </code></pre> <p>on the getview you have to:</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(_Context); i.setImageResource(R.drawable.YourPicture); i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); //setting the scale: int viewWidthtmp; int viewHeighttmp; if(getHeight() == 0) { if(_horizGallery.getWidth() == 0){ viewWidthtmp = _horizGallery.getWidth(); viewHeighttmp = _horizGallery.getHeight(); } else { viewWidthtmp = _screenWidth; viewHeighttmp = _screenHeight; } //getting the size of the image. BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; //returns null, but fills the out methods bm = BitmapFactory.decodeResource(getResources(), R.drawable.YourPicture, o); if(o.outHeight&gt; viewHeight || o.outWidth&gt; viewWidth) {i.setScaleType(ImageView.ScaleType.CENTER_INSIDE);} else {i.setScaleType(ImageView.ScaleType.FIT_CENTER);} //DO NOT ADD the line below //i.setBackgroundResource(mGalleryItemBackground); return i; } </code></pre> <p>You also have to declare 2 global variables variables and initialize them in the OnCreate of the activity.</p> <pre><code>public class ScrollingGallery extends Activity { private int _screenWidth; private int _screenHeight; ... public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.scrollingallery); Display display = getWindowManager().getDefaultDisplay(); _screenWidth = display.getWidth(); _screenHeight = display.getHeight(); ... </code></pre> <p>After that you just have to mak the gallery scroll with a timer.</p> <p>if I'm not mistaken, this should work wth a full page gallery. Code is a little long and i just wrote it so might have a bug.</p>
 

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