CircularDialogs
1.2
CircularDialogs是自定義的Android對話框庫,可提供有關成功,警告和錯誤等常見操作的用戶反饋。您可以通過將依賴關係添加到Gradle文件中來輕鬆使用IT。它允許您僅使用幾行代碼進行精美的對話框。您可以從預定義的條目和退出動畫中進行選擇。您可以使用很多選項,如下所述:
在存儲庫結束時將其添加到root build.gradle中:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
添加依賴關係
dependencies {
compile 'com.github.hassanusman:CircularDialogs:1.2'
}
new CDialog(this).createAlert("You missed something",
CDConstants.WARNING, // Type of dialog
CDConstants.LARGE) // size of dialog
.setAnimation(CDConstants.SCALE_FROM_BOTTOM_TO_TOP) // Animation for enter/exit
.setDuration(2000) // in milliseconds
.setTextSize(CDConstants.LARGE_TEXT_SIZE) // CDConstants.LARGE_TEXT_SIZE, CDConstants.NORMAL_TEXT_SIZE
.show();
這是您可以用來使事物看起來與眾不同的不同自定義。
用於動畫
CDConstants.SCALE_FROM_BOTTOM_TO_TOP, CDConstants.SCALE_FROM_RIGHT_TO_LEFT,
// Bottom and top can be exchanged as well as right to left.
// Like scale you can also use SLIDE animation just replace SLIDE with SCALE.
CDConstants.SLIDE_FROM_BOTTOM_TO_TOP
文字大小
setTextSize(CDConstants.NORMAL_TEXT_SIZE | CDConstants.LARGE_TEXT_SIZE);
// NOTE: If you give any other value it won't work always use these two values only.
期間
您可以以毫秒為單位的持續時間。如果您不提供持續時間對話框,則在用戶點擊屏幕後將關閉。
.setDuration(2000) // in milliseconds
對話框類型
目前,僅支持三種類型的對話框。 Succes,cdconstants.warning和cdconstants.error。請參見使用的最佳示例。
您可以根據需要使用自己的圖標。這是這樣的方式:
CDialog createAlert(String message,Bitmap icon,int alertType,int size); // using Bitmap
CDialog createAlert(String message,Drawable icon,int alertType,int size); // Using Drawable
// Everything will be same just parameters are changed.
...
Hassanusman