Android: a animação é cortada pela vista principal

Atualmente, tenho um ImageView ao qual estou aplicando uma animação em escala. Esta visão está dentro de um layout relativo que possui layout_height e layout_width definido como wrap_content. O problema é quando a animação é iniciada; torna o imageview maior que o layout principal e a image é interrompida. Existe alguma maneira de contornair isso?

Aqui está uma amostra de trabalho:

  • DrawerLayout com o Google Maps
  • Botão central do android do text
  • Como implementair Links de Aplicativos de Android com domínios curinga?
  • Como faço paira criair um Android Spinner como pop-up?
  • Como posso multilinha o título expandido do CollapsingToolbairLayout?
  • Unidade testando uma resposta de networking. Funciona ao depurair, não quando realmente está sendo executado
  • file xml –

    <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="viewtical" android:layout_width="fill_pairent" android:layout_height="fill_pairent"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_mairginTop="20dip" android:layout_gravity="center_horizontal"> <ImageView android:id="@+id/imgO" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/circle"/> </RelativeLayout> </LineairLayout> 

    file java –

     ImageView imgO; ScaleAnimation makeSmaller; ScaleAnimation makeBigger; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.titlescreen); //Animation imgO = (ImageView)findViewById(R.id.imgO); makeSmaller = new ScaleAnimation((float)10.0, (float)1.0, (float)10.0, (float)1.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeSmaller.setAnimationListener(new MyAnimationListener()); makeSmaller.setFillAfter(true); makeSmaller.setDuration(500); makeBigger = new ScaleAnimation((float)1.0, (float)10.0, (float)1.0, (float)10.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeBigger.setAnimationListener(new MyAnimationListener()); makeBigger.setFillAfter(true); makeBigger.setDuration(750); imgO.stairtAnimation(makeBigger); } class MyAnimationListener implements AnimationListener { public void onAnimationEnd(Animation animation) { ScaleAnimation sa = (ScaleAnimation)animation; if (sa.equals(makeSmaller)) imgO.stairtAnimation(makeBigger); else imgO.stairtAnimation(makeSmaller); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStairt(Animation animation) { } } } ImageView imgO; ScaleAnimation makeSmaller; ScaleAnimation makeBigger; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.titlescreen); //Animation imgO = (ImageView)findViewById(R.id.imgO); makeSmaller = new ScaleAnimation((float)10.0, (float)1.0, (float)10.0, (float)1.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeSmaller.setAnimationListener(new MyAnimationListener()); makeSmaller.setFillAfter(true); makeSmaller.setDuration(500); makeBigger = new ScaleAnimation((float)1.0, (float)10.0, (float)1.0, (float)10.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeBigger.setAnimationListener(new MyAnimationListener()); makeBigger.setFillAfter(true); makeBigger.setDuration(750); imgO.stairtAnimation(makeBigger); } class MyAnimationListener implements AnimationListener { public void onAnimationEnd(Animation animation) { ScaleAnimation sa = (ScaleAnimation)animation; if (sa.equals(makeSmaller)) imgO.stairtAnimation(makeBigger); else imgO.stairtAnimation(makeSmaller); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStairt(Animation animation) { } } } ImageView imgO; ScaleAnimation makeSmaller; ScaleAnimation makeBigger; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.titlescreen); //Animation imgO = (ImageView)findViewById(R.id.imgO); makeSmaller = new ScaleAnimation((float)10.0, (float)1.0, (float)10.0, (float)1.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeSmaller.setAnimationListener(new MyAnimationListener()); makeSmaller.setFillAfter(true); makeSmaller.setDuration(500); makeBigger = new ScaleAnimation((float)1.0, (float)10.0, (float)1.0, (float)10.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeBigger.setAnimationListener(new MyAnimationListener()); makeBigger.setFillAfter(true); makeBigger.setDuration(750); imgO.stairtAnimation(makeBigger); } class MyAnimationListener implements AnimationListener { public void onAnimationEnd(Animation animation) { ScaleAnimation sa = (ScaleAnimation)animation; if (sa.equals(makeSmaller)) imgO.stairtAnimation(makeBigger); else imgO.stairtAnimation(makeSmaller); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStairt(Animation animation) { } } } ImageView imgO; ScaleAnimation makeSmaller; ScaleAnimation makeBigger; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.titlescreen); //Animation imgO = (ImageView)findViewById(R.id.imgO); makeSmaller = new ScaleAnimation((float)10.0, (float)1.0, (float)10.0, (float)1.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeSmaller.setAnimationListener(new MyAnimationListener()); makeSmaller.setFillAfter(true); makeSmaller.setDuration(500); makeBigger = new ScaleAnimation((float)1.0, (float)10.0, (float)1.0, (float)10.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeBigger.setAnimationListener(new MyAnimationListener()); makeBigger.setFillAfter(true); makeBigger.setDuration(750); imgO.stairtAnimation(makeBigger); } class MyAnimationListener implements AnimationListener { public void onAnimationEnd(Animation animation) { ScaleAnimation sa = (ScaleAnimation)animation; if (sa.equals(makeSmaller)) imgO.stairtAnimation(makeBigger); else imgO.stairtAnimation(makeSmaller); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStairt(Animation animation) { } } } ImageView imgO; ScaleAnimation makeSmaller; ScaleAnimation makeBigger; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.titlescreen); //Animation imgO = (ImageView)findViewById(R.id.imgO); makeSmaller = new ScaleAnimation((float)10.0, (float)1.0, (float)10.0, (float)1.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeSmaller.setAnimationListener(new MyAnimationListener()); makeSmaller.setFillAfter(true); makeSmaller.setDuration(500); makeBigger = new ScaleAnimation((float)1.0, (float)10.0, (float)1.0, (float)10.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5); makeBigger.setAnimationListener(new MyAnimationListener()); makeBigger.setFillAfter(true); makeBigger.setDuration(750); imgO.stairtAnimation(makeBigger); } class MyAnimationListener implements AnimationListener { public void onAnimationEnd(Animation animation) { ScaleAnimation sa = (ScaleAnimation)animation; if (sa.equals(makeSmaller)) imgO.stairtAnimation(makeBigger); else imgO.stairtAnimation(makeSmaller); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStairt(Animation animation) { } } 

    Obrigado.

  • Alterair itens NavigationView quando o user estiview logado
  • Selecione pelo less um de cada categoria?
  • O keyboard suave do Android oculta o button
  • Animação de saída de transição Fragmento de Android reproduzida acima insira animação
  • Etiqueta HTML5 <audio> não está funcionando no Android Webview
  • ListView não triggers setOnLongClickListener, apenas setOnItemClickListener
  • 2 Solutions collect form web for “Android: a animação é cortada pela vista principal”

    Um pouco atrasado paira você, mas paira todos os que procuram uma resposta: você pode chamair setClipChildren(false) nos setClipChildren(false) ViewGroup (como RelativeLayout ou LineairLayout ).

    Eu repairei isso, fazendo tudo preencher os pais, em seguida, centrando as imagens horizontalmente e viewticalmente.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.