<span id="Label3"></p><strong><strong>? Gallery</strong></strong><p><p>The function of the end of gallery is to slide the contents of the Flash. For example, Sometimes when we download an app, we look at his features and interface in the marketplace, and the content we view is displayed by means of a sliding method, which is finished with the gallery Control.</p></p><p><p>The end of gallery also requires the use of adapter. first, Let's look at some common features of gallery:</p></p> <ul> <ul> <li><strong>spacing features:</strong> domination of two item out of how much distance;</li> <li><p><strong>unselectalpha features:</strong> set transparency; when the base item gets to the focus, it will not flash the feature of Transparency.</p><p>Gallery's monitoring is completed by onitemselectlistener, which allows the view to be centered during the gallery Flash.</p></li> </ul> </ul><p><p>Activity content: (the Use of adapter is no longer specifically depicted)</p></p><pre class="prettyprint"><span class="hljs-keyword">Public<span class="hljs-class"><span class="hljs-keyword">Class<span class="hljs-title">Mainactivity<span class="hljs-keyword">Extends<span class="hljs-title">Activity {<span class="hljs-keyword">Private Gallery mgalleryview;<span class="hljs-keyword">Private listmfruits;<span class="hljs-keyword">Private Layoutinflater minflater;<span class="hljs-keyword">Private Mygalleryadapter mmygalleryadapter;<span class="hljs-annotation">@Override<span class="hljs-keyword">Protected<span class="hljs-keyword">void<span class="hljs-title">OnCreate (Bundle Savedinstancestate) {<span class="hljs-keyword">Super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); Mgalleryview = (Gallery) Findviewbyid (r.id.galleray_fruit); Minflater = Getlayoutinflater ();<span class="hljs-comment">Initialization of Data. InitData (); Mmygalleryadapter =<span class="hljs-keyword">New Mygalleryadapter (mfruits,minflater); Mgalleryview.setadapter (mmygalleryadapter);<span class="hljs-comment">Listen to things Mgalleryview.setonitemselectedlistener (<span class="hljs-keyword">New Adapterview.onitemselectedlistener () {<span class="hljs-annotation">@Override<span class="hljs-keyword">Public<span class="hljs-keyword">void<span class="hljs-title">onitemselected (adapterview adapterview, View view,<span class="hljs-keyword">int position,<span class="hljs-keyword">Long L) {<span class="hljs-comment">The fruit that will get to the focus, that is, the center of the fruit flashes Out. LOG.D (<span class="hljs-string">"data",<span class="hljs-string">"" +mfruits.get (position). getmfruitname ());}<span class="hljs-annotation">@Override<span class="hljs-keyword">Public<span class="hljs-keyword">void<span class="hljs-title">onnothingselected (adapterview Adapterview) {}}); }<span class="hljs-keyword">Private<span class="hljs-keyword">void<span class="hljs-title">InitData () {mfruits =<span class="hljs-keyword"><span class="hljs-keyword">New ArrayList (); <span class="hljs-keyword">for (<span class="hljs-keyword">int i=<span class="hljs-number">0; i<<span class="hljs-number">10;i++) {Fruit apple = <span class="hljs-keyword">new Fruit (r.mipmap.apple,<span class="hljs-string">"apple"); mfruits.add (apple); Fruit banana = <span class="hljs-keyword">new Fruit (r.mipmap.banana,<span class="hljs-string">"banana"); mfruits.add (banana); Fruit grape = <span class="hljs-keyword">new Fruit (r.mipmap.grape,<span class="hljs-string">"grape"); mfruits.add (grape); Fruit watermelon = <span class="hljs-keyword">new Fruit (r.mipmap.watermelon,<span class="hljs-string">"watermelon"); mfruits.add (watermelon); Fruit pineapple = <span class="hljs-keyword">new Fruit (r.mipmap.pineapple,<span class="hljs-string">"pineapple"); mfruits.add (pineapple); Looking to read the specific tutorial site www.keymob.com/ tutorial_zh/index.html</span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></pre><p><p></p></p><p><p></p></p><p><p></p></p><p><p>Android UI Design--gallery Controls</p></p></span>
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