我正在建立一个“扩大”的估算。 扩大的备选办法是:垂直<代码>LinearLayout。 <代码>Translate Animation 适用于周围的<代码>LinearLayout,使备选办法从底线上扩展。
问题是,只展示第一部封顶的<代码>RelativeLayout。 第二种情况是显而易见的,没有估计。
Below, the XML layout in question, the method applying the animation, and the call. Thank you very much for your thoughts
<LinearLayout
android:id="@+id/bmb_navigation_expanded"
style="@style/bmb_RelativeLayout"
android:layout_above="@id/bmb_bottom_bar"
android:orientation="vertical"
android:visibility="gone" >
<RelativeLayout
style="@style/bmb_RelativeLayout">
option 1 stuff
</RelativeLayout>
<RelativeLayout
style="@style/bmb_RelativeLayout">
option 2 stuff
</RelativeLayout>
</LinearLayout>
3. 计算线索的方法:
public static void setSlideIn(ViewGroup panel, Context ctx) {
AnimationSet set = new AnimationSet(false);
Animation animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f
);
animation.setDuration(200);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 0);
panel.setLayoutAnimation(controller);
}
这就是我所说的::
layout.setVisibility(View.VISIBLE);
setSlideIn(layout, getActivity());