CircularDialogs
1.2
Circulardialogsは、成功、警告、エラーなどの一般的な操作についてユーザーフィードバックを提供するカスタムAndroidダイアログライブラリです。 Gradleファイルに依存関係を追加することで、ITを簡単に使用できます。わずかなコードで美しいダイアログを作成できます。事前に定義されたエントリとExitアニメーションから選択できます。以下で説明するように、多くのオプションを使用できます。
ルートビルドに追加します。リポジトリの最後にグラデーション:
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
ダイアログタイプ
現在、3種類のダイアログのみがcdconstants.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.
...
ハッサナスマン