2016-04-09 41 views
1

私は2つの画像(プラスと乗算)を表示しています。 'プラス'画像をクリックすると、 'multiply'画像が 'plus私の問題は、 'multiply'画像が添付された2番目の画像に表示されている 'plus'画像の前でアニメーション化されていることです。「plus」画像の後ろにアニメートしたいのですが、イメージは前面にありません。画像ビューをアニメーション化する方法Androidで他の画像ビューの後ろに

画像のレイアウトのための私のxml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 


<LinearLayout 
    android:id="@+id/parent" 
    android:layout_width="match_parent" 
    android:layout_height="40dp" 
    android:layout_marginTop="100dp" 
    android:clipChildren="false" 
    android:clipToPadding="false"> 

    <ImageView 
     android:id="@+id/plus" 
     android:layout_width="80dp" 
     android:layout_height="wrap_content" 
     android:clickable="true" 
     android:clipChildren="true" 
     android:clipToPadding="true" 
     android:scaleType="centerInside" 
     android:src="@drawable/plus" /> 


    <ImageView 
     android:id="@+id/multiply" 
     android:layout_width="80dp" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     android:clickable="true" 
     android:scaleType="centerInside" /> 

</LinearLayout> 
</LinearLayout> 

enter image description here

enter image description here

enter image description here

答えて

1

だけRelative layoutを使用し、少し変更...この

0123のような

enter image description here

+0

ではなく、相対的なレイアウトを使用して、ありがとうございました線形レイアウトの私の問題を解決しました。 – nihasmata

1
  1. 変更のxmlレイアウトシーケンス:RelativeLayoutのために

    • 、あなたがXMLで書いた最初のビューは、まず描画されます。
    • したがって、まずmultiply imageviewを書いてから、それに加えてimageviewを書く必要があります。
  2. zオーダーを動的に変更したい場合は、view.bringToFront()APIを使用できます。

+0

ありがとう、私の問題を解決した線形レイアウトの代わりに相対レイアウトを使用しています。 – nihasmata

関連する問題