2017-08-05 8 views
0

私はLinearLayoutに3つの要素があり、これらのいずれかをアニメーション化する必要があります。
アニメーションが開始されると、要素は他の要素よりも上にはありませんが、下に残ります。
私はすでにbringToFront()を使用しようとしましたが、動作しません(docのように注文を変更します)。
この "垂直"レイアウトの "@ id/ton"をアニメーション化する必要がある要素。Android Linear Layout z-order animation

<LinearLayout 
    android:id="@+id/wrapInfo" 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:layout_marginLeft="5dp" 
    android:layout_marginRight="5dp" 
    android:focusable="false" 
    android:layout_gravity="center_horizontal" 
    android:orientonion="vertical" 
    android:clipChildren="false" > 

    <ImageButton 
     android:id="@+id/imageView1" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:layout_marginBottom="5dp" 
     android:background="@null" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:layout_gravity="center_horizontal" 
     android:src="@drawable/yourlogohere" /> 

    <TextView 
     android:id="@+id/ton" 
     android:layout_height="0dp" 
     android:layout_weight="2"/> 

    <WebView 
     android:id="@+id/web" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight = "1" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     /> 

</LinearLayout> 

この場合、TextViewはWebViewの下にあります。
これらの要素は、デバイスの高さの25/50/25%(私はweight xml属性を使用しています)である必要があるため、LinearLayoutを使用します。

答えて

-1

Z-Orderは、Orderを変更してからremoveView()を使用し、次に新しいインデックスでaddView()を使用する場合は、ViewGroup子配列のインデックスです。

LinearLayoutの場合、ビューがインデックス0で追加されている場合は、ビューがindex == viewGroup.getChildrenCount()-1で追加されている場合は上部に配置され、下部に配置されます。

viewGroup.requestLayout();後で