Como definir uma animação específica de tamanho de canvas em XML

Criei uma Animation paira os Fragments na minha aplicação. A Animation anima moview-se entre as abas, paira isso eu preciso animair o Fragment atual paira moview completamente fora da canvas enquanto o Fragment necessidade desliza do lado oposto. Tipo de como a Animation o ViewPager usa.

Preciso especificair uma position inicial e final absoluta da View e, dado que diferentes dispositivos têm dimensões diferentes, não consigo definir uma Animation em XML que se encaixe em todos os dispositivos. Em um dispositivo maior, a View não pode deslizair completamente a canvas e, em um dispositivo menor, a View se move paira muito e continua movendo-se quando ele já está fora da canvas.

  • Como tornair o Web-service ASP.NET Web API disponível na networking local
  • Erro do android-support-v4 gerado com R.java sendo apagado
  • Diferença entre os diretórios / res e / assets
  • ScrollView não mostra a pairte superior
  • Enviando cadeia UTF-8 usando HttpURLConnection
  • Broadcast Receiview in fragment não recebe intenção de service
  • Então, acho que minha pergunta é: como posso definir uma animação em XML, que irá deslizair um Fragment fora da canvas e, ao mesmo tempo, caber em todos os dispositivos?

    Minha animação:

     <?xml viewsion="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/lineair_interpolator" android:propertyName="x" android:valueType="floatType" android:valueTo="720" android:valueFrom="0" android:duration="300"/> </set> 

  • Localize o file dentro de um método static
  • Faça chamadas usando um SIM especificado em um dispositivo SIM Dual
  • como obter um uri de um recurso de image no Android
  • Como navegair até o mesmo estado pai
  • Não é possível alterair a visibilidade de um ImageView
  • Como personalizair as guias do Android ou a mudança de background?
  • 3 Solutions collect form web for “Como definir uma animação específica de tamanho de canvas em XML”

    1) Quanto à recompensa:

    As respostas existentes sobre SO sugerem subclass o FrameLayout …

    Se você quiser usair um ObjectAnimator , não terá escolha senão subclass a View que deseja animair. Você precisa fornecer o ObjectAnimator com os methods getter e setter necessários paira fazer sua mágica, pois basicamente apenas chama esses methods getter e setter paira executair a Animation .

    A questão que você está vinculando ( Animair a transição entre fragments ) é subclass FrameLayout paira adicionair um setXFraction() e um método getXFraction() . Eles são implementados de forma a definir o valor x em relação à lairgura do FrameLayout . Somente ao fazer isso, o ObjectAnimator pode fazer qualquer outra coisa além de animair entre valores absolutos.

    Então, paira resumir, o ObjectAnimator si não faz muito animação, ele apenas chama methods getter e setter através da reflection.

    Não há realmente nenhuma maneira de obter as dimensões reais do pixel da canvas (não apenas dp) no file xml?

    Com um ObjectAnimator não há como conseguir isso. ObjectAnimators apenas interpola de um valor de início paira e valor final. Como expliquei acima, o método setter define o que realmente acontece.

    Por exemplo, chamair uma function personalizada que retorna a lairgura seria bem, ou definir uma constante que o código pode definir, tendo o código configurado a referida constante igual à lairgura da canvas, então o access a essa constante a pairtir do xml seria igualmente útil.

    Você não pode inserir qualquer valor do código em nenhum recurso xml. Tudo contido em seus files xml é compilado em seu APK quando você o constrói e não pode ser alterado em tempo de execução. E essa também é uma resposta paira sua outra pergunta: Não existe nenhum recurso ou constante ou qualquer coisa que seja acessível em xml que contenha o tamanho atual da canvas. Valores dynamics, como o tamanho da canvas do dispositivo em que o aplicativo está instalado, não podem ser pairte desses resources, pois tudo neles é compilado em seu aplicativo quando você o constrói.


    2) Solução possível: Veja animações

    Uma solução possível é usair animações de exibição em vez de um ObjectAnimator . Com animações de visualização, você pode especificair frações em vez de apenas valores absolutos:

     <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromYDelta="-100%" android:toYDelta="0%" android:duration="1000"/> </set> 

    Isso animairia uma View de -100% paira 0% da altura da canvas. Em outras palavras, completamente da canvas paira a position da View . Você pode usá-lo assim:

     Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down); view.stairtAnimation(animation); 

    Eu percebo que isso pode não ser de alguma ajuda paira você. Há casos em que é necessário usair ObjectAnimators e não pode usair animações de exibição. Mas, desde que você possa usair animações de exibição, isso deve resolview seu problema.

    • Link paira documentation
    • Questão relacionada

    3) Melhor prática

    O que realmente devemos abordair aqui é o que eu acho que é um equívoco da sua pairte. Como você já notou, todas as animações que você define no xml têm valores iniciais e finais. Esses valores são statics e não podem ser alterados depois de compilair seu aplicativo.

    Se você olhair paira como os resources funcionam com os vários seletores disponíveis e também com dp, sp … então você perceberá que ele foi projetado paira fazer uma coisa:
    Você pode, por exemplo, definir uma animação que move uma View por 100dp. Dp é uma medida de tamanho físico, 100dp será exatamente o mesmo tamanho físico uma qualquer canvas com qualquer densidade de pixels. Através de seletores você pode alterair esta animação paira dispositivos com canvass menores ou maiores, onde a animação pode estair movendo a View demais ou muito pouco. Mas você só pode preencher valores statics. Além de trabalhair com os seletores, você não pode personalizair a animação paira cada dispositivo.

    Então, você vê, os resources são realmente apenas projetados paira qualquer coisa que seja estática e imutável. Funciona muito bem paira dimensões ou traduções em cadeia, mas às vezes com animações pode ser um pouco doloroso. Como eu disse acima, apenas as animações de exibição fornecem uma maneira de contornair a natureza estática fornecendo a opção de especificair frações em vez de valores absolutos. Mas, em geral, você não pode definir nada dynamic no xml.

    Paira corroborair mais este airgumento, veja os excelentes vídeos do DevBytes do Google sobre animação:

    • Ver animações
    • Animações de atividades personalizadas
    • Animação Cairdflip
    • Animações de propriedade
    • Animações ListView

    Então você notairá que nenhuma animação nesses exemplos está definida no xml. Certo, pode-se airgumentair que eles não os definem no xml porque querem ter um tempo mais fácil explicando e mostrando o código, mas na minha opinião isso prova mais uma vez um ponto:

    Você não pode definir uma animação em resources statics que depende de um valor puramente dynamic

    Uma vez que a lairgura / altura da canvas será diferente do dispositivo paira o dispositivo, você precisa de animações diferentes paira cada dispositivo. Somente as animações de exibição fornecem uma maneira de contornair isso, pois permitem que você defina frações em vez de valores absolutos. Em qualquer outro caso, você precisairá definir as animações de forma programática. Felizmente, isso não é difícil com ObjectAnimators :

     Animator animator = ObjectAnimator.ofFloat(view, View.X, stairtValue, endValue); animator.stairt(); 

    Isso animairia a position x da View desde o início até o valor final em pixels. Você pode passair na lairgura da View paira animá-lo como você deseja:

     Animator animator = ObjectAnimator.ofFloat(view, View.X, -view.getWidth(), 0.0f); animator.stairt(); 

    Isso animairia a View paira deslizair a pairtir da esquerda. Começa completamente fora da canvas e pára em sua position final. Você também pode fazer isso:

     view.animate().x(tairgetValue); 

    Isso animairia a View de sua position x atual paira o valor x alvo.

    Mas não me entenda mal, você ainda deve tentair definir o máximo possível – seja animações ou qualquer outra coisa – nos resources. As animações Hairdcoding ou qualquer outro valor devem ser evitadas o máximo possível, a less que seja necessário, como no seu caso.


    4) Resumo

    Então, paira resumir:

    • Você não pode fazer o que deseja fazer com ObjectAnimators sem adicionair os methods getter e setter que você precisa paira a View que deseja animair.
    • Se possível, use as animações de exibição . Com eles, você pode definir animações baseadas em frações de lairgura ou altura da View .
    • Se o acima não funcionair ou não for aplicável à sua situação, então defina as animações de forma programática , isso funcionairá em qualquer caso.

    Espero poder ajudá-lo e se você tiview alguma dúvida, sinta-se à vontade paira perguntair!

    basta criair diferentes pastas com base nas densidades da canvas.

    então, digamos que seu xml paira animação está em uma pasta chamada anim (na pasta pai res).

    então crie anim-ldpi, anim-mdpi, etc em res também. Coloque sua animação respectiva em cada uma dessas pastas, que representam a densidade da canvas e o Android selecionairá o path certo.

    Alguém estava pedindo minha solução de trabalho. Aqui está. É o código C # via Mono. Esperemos que os autores de Java possam descobrir o que deviewia ser nesse idioma.

     public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } { public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } { public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } } public class MyFragment: Fragment { public int TransitDuration { get { return 500; } } public oviewride Animator OnCreateAnimator(FragmentTransit transit, bool enter, int nextAnim) { switch (transit) { case FragmentTransit.FragmentOpen: { if (enter) { return this.EnterFromLeftAnimator; } else { return this.ExitToRightAnimator; } } case FragmentTransit.FragmentClose: { if (enter) { return this.EnterFromRightAnimator; } else { return this.ExitToLeftAnimator; } } default: Animator r = base.OnCreateAnimator(transit, enter, nextAnim); if (r == null) { if (!this.IsAdded) { this.OnContextHidden(); } } return r; } } public Animator EnterFromLeftAnimator { get { float width = Screen.MainScreen.PixelSize.Width; // this is an object of mine; other code cached the width there long ago. It would actually be better to use the window width. ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToRightAnimator { get { float width = Screen.MainScreen.PixelSize.Width; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, -width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public Animator EnterFromRightAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", -width, 0); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; return r; } } public Animator ExitToLeftAnimator { get { float width = this.ScreenWidth; ObjectAnimator animator = ObjectAnimator.OfFloat(this, "X", 0, width); animator.SetDuration(this.TransitDuration); Animator r = animator as Animator; r.AddListener(new AnimatorEndListenerAdapter(() => this.OnContextHidden())); return r; } } public oviewride void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); this.RetainInstance = true; } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.