Implement nine (n) Sudoku image continuous sliding effect in Android app _android

Source: Internet
Author: User
Tags event listener

Today, the reason for writing this article is a time ago a netizen in my blog above the message, want to achieve in GridLayout (equivalent to nine Sudoku) Click on each item can slide to show the Sudoku picture, when the Sudoku picture is displayed, then display the next Sudoku picture. Then read my previous article on the slide of friends, I believe that to achieve the former effect is not difficult, the key lies in how to achieve the latter, that is, how to display the Sudoku after a picture, and then display the next Sudoku picture. So that's what we're going to explore today in this article.

  

Speaking of this, first to the Netizen said sorry, because the previous days too busy, until now there is a little time to write this article, after all, ordinary work is also busy, not immediately answer everyone's questions, but also please understand.

OK, let's go back to the introduction of our content. What kind of functionality does the example we implement have in this article? To learn more about Android, my example implements the following features in addition to the functionality discussed above:

    • Picture multi-line Cheng;
    • Images can be automatically browsed;
    • Can hide head and bottom;
    • When the picture is loaded, the flop effect can be displayed;
    • The 3D switching effect is realized when Sudoku switch;
    • Sudoku pictures can be switched into ListView style;
    • You can configure various options, such as cache size, thread pool size, picture display, and so on.

For all of us to understand better, let's take a look at the effect chart to be implemented:

After you look at the effect map, there will be a sense of déjà vu. This is true, because this effect is more common in news clients, and it can be used in other applications as well.

Let's start the implementation process below.

Familiarize yourself with the next Mainactivity.java code, as follows:

Package com.palace.image.activity;
Import com.image.loader.core.DisplayImageOptions;
Import COM.PALACE.IMAGE.R;

Import Com.palace.image.adapter.GridViewAdapter;
Import android.content.Intent;
Import Android.graphics.Color;
Import android.graphics.drawable.ColorDrawable;
Import Android.os.Bundle;
Import Android.view.View;
Import Android.widget.AdapterView;
Import Android.widget.GridView;

Import Android.widget.AdapterView.OnItemClickListener; /** * Android to achieve the continuous sliding effect of the image of the uterus * @Description: Android to achieve the continuous sliding effect of the image of the uterus @File: Mainactivity.java * @Package com.palace.image Activity * @Author Hanyonglu * @Date 2012-09-19 pm 05:57:34 * @Version V1.0 * * public class Mainactivity extends Ba
  seactivity {private GridView GridView = null;
  Private string[] imagevalues = null;
  Private string[] titlevalues = null;
  
  Private displayimageoptions options; /** called the activity is a. */@Override public void OnCreate (Bundle savedinstancestate) {super.oncreate (savEdinstancestate);
    
    Setcontentview (r.layout.main_activity);
  Initialization of Initviews (); 
    }/** * Initialize/private void Initviews () {titlevalues = Getresources (). Getstringarray (R.array.news_title);
    Imagevalues = Getresources (). Getstringarray (R.array.small_images); options = new Displayimageoptions.builder (). Showstubimage (R.drawable.ic_image_load). Showimageforemptyuri (R.D
    
    rawable.ic_image_load). Cacheinmemory (). Cacheondisc (). build ();
    GridView = (GridView) Findviewbyid (R.id.gridview);
    Gridview.setselector (New colordrawable (color.transparent));
    Gridview.setadapter (This, imagevalues,titlevalues,imageloader,options) (new Gridviewadapter);
  Gridview.setonitemclicklistener (Itemonclicklistener);  }//GridView Click Item Event Listener private Onitemclicklistener Itemonclicklistener = new Onitemclicklistener () {public void
     Onitemclick (adapterview<?> parent, View v, int position, long ID) { Intent Intent = new Intent ();
      Intent.setclass (Mainactivity.this, Imageactivity.class);
      Intent.putextra ("Item_index", position);
    StartActivity (Intent);
  
  }
  };
    @Override protected void OnStop () {super.onstop ();
  Imageloader.stop ();
    @Override protected void OnDestroy () {//TODO auto-generated Method Stub Super.ondestroy ();
  Imageloader.stop ();
 }
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.