The Toast of Android development

Source: Internet
Author: User
<span id="Label3"></p><p><p>For the first time in the blog Park to publish the article, I just figured out about the Android development of the prompt settings, share to Everyone.</p></p><p><p>Toast is often used in android, a method used for simple user hints, after groping I found two ways to use toast, first of all, to share, but also look at the master Advice.</p></p><p><p><strong>The first system defaults to the Way:</strong></p></p><p><p>Toast.maketext (getapplicationcontext (), "system comes with hint form", toast.length_short). show ();</p></p><p><p><strong>The second way of Customizing:</strong></p></p><p><p>Toast toast = new Toast (getapplicationcontext ());<br>Toast.setgravity (gravity.center_vertical, 0, 0);//setting The location of the display<br>Toast.setduration (toast.length_long);//set the displayed time<br><br>Toast.setview (getlayoutinflater (). Inflate (r.layout.activity_two,null));//set a custom view<br><br>Toast.show ();</p></p><p><p><strong>Views displayed in the Customization:</strong></p></p><p><p><linearlayout<br>Android:id= "@+id/linearlayout1"<br>Android:layout_width= "wrap_content"<br>android:layout_height= "wrap_content"<br>android:orientation= "horizontal"<br>><br><imageview<br>Android:background= "@drawable/fire_eye_alien"</p></p><p><p>Android:layout_width= "50dip"<br>android:layout_height= "50dip"<br>/><br><textview<br>Android:layout_width= "wrap_content"<br>android:layout_height= "wrap_content"<br>android:layout_gravity= "center_vertical"<br>android:text= "custom Form hints"<br>Android:textsize= "20dip"<br>/><br></LinearLayout></p></p><p><p>Personal feeling for a custom type of toast, the difficulty lies in the introduction of the view, hoping that the great God can give more guidance.</p></p><p><p></p></p><p><p>The Toast of Android development</p></p></span>

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.