Alert Dialog Builder中的活动转换

时间:2015-11-13 13:52:31

标签: javascript android android-fragments android-intent android-activity

我有AlertDialog。我无法获得幻灯片并滑出活动转换。

Java代码如下。我在开始活动后收到错误。任何人都可以帮助如何为这些添加活动过渡吗?

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    public void select2Button12b(View v) {

        dialogBuildmea112 = new AlertDialog.Builder(this);
        final String[] strSizee = {  "\nUnit 1\n\nClassification \n", "\nUnit 2\n\nComplete works \n" };

        dialogBuildmea112.setTitle("Select unit:");
        dialogBuildmea112.setSingleChoiceItems(strSizee, -1, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int whichaaede1) {

                switch(whichaaede1) {
                    case 0:
                        Intent i1 = new Intent(Worksa.this, Worksa.class);
                        this.overridePendingTransition(R.anim.right,
                                R.anim.left);
                        startActivity(i1);
                        break;
                    case 1:
                        Intent j1 = new Intent(Worksa.this, W1.class);
                        startActivity(j1);
                        this.overridePendingTransition(R.anim.right,
                                R.anim.left);

                        break;
                }
            }
        });

        AlertDialog nopb1 =  dialogBuildmea112.create();            
        nopb1.show();
    }
}

1 个答案:

答案 0 :(得分:1)

只需调整订单并进行更改:

public void select2Button12b(View v)
{


    dialogBuildmea112 = new AlertDialog.Builder(this);
    final String[] strSizee = {  "\nUnit 1\n\nClassification \n", "\nUnit 2\n\nComplete works \n"};


    dialogBuildmea112.setTitle("Select unit:");
    dialogBuildmea112.setSingleChoiceItems(strSizee, -1, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int whichaaede1) {


             switch(whichaaede1){
             case 0:
                 Intent i1 = new Intent(Worksa.this, Worksa.class);

                    startActivity(i1);
         Activity.this.overridePendingTransition(R.anim.right,
                            R.anim.left);

                    break;
             case 1:
                 Intent j1 = new Intent(Worksa.this, W1.class);
                    startActivity(j1);
                     Activity.this.overridePendingTransition(R.anim.right,
                            R.anim.left);

                    break;

             }


        }


    });


     AlertDialog nopb1 =  dialogBuildmea112.create();


        nopb1.show();


}