implement a spinning activity indicator similar to iOS in Android

后端 未结 4 848
慢半拍i
慢半拍i 2021-02-02 02:58

I am trying to implement the spinning activity similar to the the one I have placed below in Android. I believe I should use the ProgressDialog. My issue arises from how to actu

4条回答
  •  半阙折子戏
    2021-02-02 03:35

    Just look at this library. IOSDialog/Spinner library

    It is very easy to use and solves your problem. With it, you can easily create and use spinner like in IOS. The example of code:

    final IOSDialog dialog1 = new IOSDialog.Builder(IOSDialogActivity.this)
                .setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        dialog0.show();
                    }
                })
                .setDimAmount(3)
                .setSpinnerColorRes(R.color.colorGreen)
                .setMessageColorRes(R.color.colorAccent)
                .setTitle(R.string.standard_title)
                .setTitleColorRes(R.color.colorPrimary)
                .setMessageContent("My message")
                .setCancelable(true)
                .setMessageContentGravity(Gravity.END)
                .build();
    

    Result

     final IOSDialog dialog0 = new IOSDialog.Builder(IOSDialogActivity.this)
                .setTitle("Default IOS bar")
                .setTitleColorRes(R.color.gray)
                .build();
    

    Result: stadard IOS Dialog

提交回复
热议问题