Android development-Tomast and androidtomast

Source: Internet
Author: User

Android development-Tomast and androidtomast

The first time I published an article in the blog, I will share with you the prompt settings I just learned about Android development.

Tomast is a frequently used method in Android. It is used for simple user prompts. After exploring it, I found two ways to use Tomast. I will share it with you.

The first default method is as follows:

Toast. makeText (getApplicationContext (), "the system prompts", Toast. LENGTH_SHORT). show ();

The second custom mode:

Toast toast = new Toast (getApplicationContext ());
Toast. setGravity (Gravity. CENTER_VERTICAL, 0, 0); // you can specify the display position.
Toast. setDuration (Toast. LENGTH_LONG); // you can specify the display time.

Toast. setView (getLayoutInflater (). inflate (R. layout. activity_two, null); // you can specify a custom view.

Toast. show ();

View displayed in custom mode:

<LinearLayout
Android: id = "@ + id/linearLayout1"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: orientation = "horizontal"
>
<ImageView
Android: background = "@ drawable/fire_eye_alien"

Android: layout_width = "50dip"
Android: layout_height = "50dip"
/>
<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_gravity = "center_vertical"
Android: text = "custom format prompt"
Android: textSize = "20dip"
/>
</LinearLayout>

I personally feel that the difficulty for custom Tomast lies in the introduction of views. I hope the gods can provide more guidance.

 


Which of the following is a good example of Google Android SDK development?

I personally think that if you are a newbie and want to learn about Android and do not use the mars video tutorial or platform development, you will have a great trip, if you need to make something to illustrate how to cover more things, you can give a lot of reference. Weak wood has little access to or comes into contact with Android, just like a couple of such drops or two get started, eight times. Example: Is there an electronic file platform development? Even wood has a bottom ....

Android development self-learning path

Android is based on java code, so you must first learn the basic java code, that is, java se, without learning java EE. Then you can learn about Android.

The Innovation Office has some Android videos, which are relatively complete. You can check them out.

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.