Thus, you will not see the effect of the elf.
There is one way to do this with the gallery.
create a gallery as follows:
<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"/>
in the viewing field you should:
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> viewHeight || o.outWidth> 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; }
You must also declare 2 variables of global variables and initialize them in OnCreate activity.
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(); ...
After that, you just need to scroll through the gallery using the timer.
If I'm not mistaken, this should work with a full gallery of pages. The code is a bit long and I just wrote it, so there might be a mistake.
J-rou source share