如何为Angular Material 2对话框设置动画?

时间:2017-07-26 15:26:21

标签: angular angular-material2

如何为Angular Material 2对话框设置动画?

我尝试使用正常的Angular 2+动画理论。它可以工作,但会发生什么是对话框上的元素被动画化(如预期的那样),对话框就会停留。但我想要的是对话框本身应该动画,例如,不透明度应该在几秒钟内从1变为0。

我还检查了public class AnaMenu extends AppCompatActivity { public static final int MENU_Ara = Menu.FIRST + 1; OyunTextView oyunTextView; static final int AnketDegerlendirmesi = 1337; int selectedPosition ; String[] afteractivitydialogitems; int toplamaislemi; String[] dialogdegerleri; boolean[] dialogcheckeditems; String toast; TextView sayılar; ListView liste; int a = 60 ; ArrayList<String> kullanıcısayıdegerlistesi = new ArrayList<>(); ArrayList<Integer> mUserselecteditems = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ana_menu); liste = (ListView) findViewById(R.id.oyun); //Adapter im. oyunTextView = new OyunTextView(); liste.setAdapter(oyunTextView); registerForContextMenu(liste); afteractivitydialogitems = getResources().getStringArray(R.array.anket); dialogcheckeditems = new boolean[afteractivitydialogitems.length]; dialogdegerleri = getResources().getStringArray(R.array.anketdeğer); //show the first activity when First time launched application. SharedPreferences prefs = this.getSharedPreferences("MyAppPrefs", MODE_PRIVATE); boolean settingsFilled = prefs.getBoolean("SettingsFilled", false); if (!settingsFilled){ Intent sa = new Intent(AnaMenu.this,MainActivity.class); startActivity(sa); SharedPreferences pr = this.getSharedPreferences("MyAppPrefs", MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("SettingsFilled", true); editor.commit(); } } class OyunTextView extends BaseAdapter { @Override public int getCount() { Intent i = getIntent(); final ArrayList<String> secilmis = i.getStringArrayListExtra("listem"); return secilmis.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = getLayoutInflater().inflate(R.layout.oyuntextview, null); TextView namesbox = (TextView) convertView.findViewById(R.id.isim); sayılar = (TextView) convertView.findViewById(R.id.sayı); Intent i = getIntent(); final ArrayList<String> secilmis = i.getStringArrayListExtra("listem"); for (int defa = 0; defa < secilmis.size(); defa++) { kullanıcısayıdegerlistesi.add("50"); // if (kullanıcısayıdegerlistesi.contains("50")){sayılar.setTextColor(getResources().getColor(R.color.elli));} } namesbox.setText(secilmis.get(position)); sayılar.setText(kullanıcısayıdegerlistesi.get(position)); sayılar.setTextColor(getResources().getColor(R.color.elli)); convertView.setBackgroundColor(getResources().getColor(R.color.yüz)); return convertView; } } 方法是否有任何动画选项,但似乎没有。

将对话框的不透明度从1设置为0(例如在关闭它之前)是一个常见的用例,如何使用Angular Material 2对话框实现它?

3 个答案:

答案 0 :(得分:0)

默认情况下,对话框应为动画,如here所示。您是否在应用中加入了BrowserAnimationsModule

答案 1 :(得分:0)

此功能尚不可用。您可以跟踪状态here

答案 2 :(得分:0)

您可以查看我所做的here或安装的module