2016-03-28 34 views
1

我有佈局,它由下面顯示的圖像部分組成。我只是想要設置所有圖像資源的翻譯動畫,從底部開始。當這樣做時,動畫開始落後於其他圖像佈局。我剛剛搜索瞭解決方案,但未找到解決方案。翻譯動畫是在其他組件後面

android:clipChildren="false"; 
yourLayout.bringToFront(); 
setZAdjustment(Animation.ZORDER_TOP); 

以上所有解決方案都不適用於我。有人可以幫助我嗎?

我的XML代碼來創建圖像按鈕是

<TableRow 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="1"> 

    <LinearLayout 
     android:layout_width="0dip" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:adjustViewBounds="true" 
     android:background="@drawable/bck_game_image" 
     android:layout_margin="1dp"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_margin="4dp" 
      android:background="@drawable/bos"> 

      <ImageButton 
       android:id="@+id/buton0" 
       android:layout_width="0dip" 
       android:layout_height="fill_parent" 
       android:layout_weight="1" 
       android:adjustViewBounds="true"></ImageButton> 
     </LinearLayout> 

    </LinearLayout> 
..... 
</TableRow> 

enter image description here

+0

請發表您的xml代碼 –

+0

添加了xml代碼 – nihasmata

+0

更具體。我不明白你的問題。您想要製作哪些佈局?您可以使用Java代碼輕鬆完成。 –

回答

0

而不是使用yourLayout.bringToFront(),使用下面的代碼行: -

linearLayout.bringChildToFront(imageView); 
linearLayout.requestLayout(); 
linearLayout.invalidate(); 
+0

它可以工作,但圖像按鈕的索引在上面的代碼行之後會改變。例如,我爲左上角的圖像按鈕設置動畫,但它會影響右上角的最大圖像按鈕。 – nihasmata

+0

索引,你的意思是ImageButton的ID?或者是其他東西 ? –

+0

當我使用您指定的代碼時,動畫會影響另一個圖像按鈕,而不是我的目標。我認爲圖像按鈕的位置正在改變。 – nihasmata