漂亮的Material Design Toasts - Load Toast Library
Load Toast Library是一個漂亮的Material Design Toasts,擁有反饋動畫。
Demo
Usage
Step 1
Gradle
dependencies {
compile 'net.steamcrafted:load-toast:1.0.6' }
Step 2
The API is very simple, create a new toast by providing a context:
LoadToast lt = new LoadToast(context);
Change the displayed text:
lt.setText("Sending Reply...");
Then proceed to show the toast:
lt.show();
When your background thingy is done provide feedback to the user and hide the toast:
// Call this if it was successful lt.success(); // Or this method if it failed lt.error();
If you are using translucent actionbar in a full screen activity it will appear over the actionbar, fortunately there is a method to change the y translation:
lt.setTranslationY(100); // y offset in pixels
You can also change the colors of the different toast elements:
lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE);
These can be chained as you can see.
https://github.com/code-mc/loadtoast 本文由用戶 n342 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!