Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当slidingdrawer打开时,listview参数会更改_Android_Android Layout_Animation_Slidingdrawer - Fatal编程技术网

Android 当slidingdrawer打开时,listview参数会更改

Android 当slidingdrawer打开时,listview参数会更改,android,android-layout,animation,slidingdrawer,Android,Android Layout,Animation,Slidingdrawer,我的应用程序中有一个小动画,动画的结尾会更改ListView的位置参数:listArr.layout(0,(int)(actionBar.getHeight()+filterTabHeight), listArr.getWidth(),(int)(actionBar.getHeight()+listArr.getHeight()+filterTabHeight)) i、 e.它的设置比启动时稍微低一点(它以全屏方式启动,按下按钮后,向下滑动一点,在屏幕顶部显示它下面的东西) 通过按下列表,我可以

我的应用程序中有一个小动画,动画的结尾会更改ListView的位置参数:
listArr.layout(0,(int)(actionBar.getHeight()+filterTabHeight),
listArr.getWidth(),(int)(actionBar.getHeight()+listArr.getHeight()+filterTabHeight))

i、 e.它的设置比启动时稍微低一点(它以全屏方式启动,按下按钮后,向下滑动一点,在屏幕顶部显示它下面的东西)

通过按下列表,我可以看到它的参数确实发生了变化,它的位置也发生了变化。现在,如果滑动抽屉在该点被打开,布局将被重新安排,列表将在其打开时回到全屏

为什么会这样

private void setFilterAnimationAnimation(boolean isOpenAnimation) {
    TranslateAnimation verticalAnimation;
    float scale = context.getResources().getDisplayMetrics().density;
    filterTabHeight = FILTER_HEIGHT_IN_DP * scale;

    if (isOpenAnimation) {
        listArr.layout(0, (int) (actionBar.getHeight() + filterTabHeight), 
                listArr.getWidth(), (int) (actionBar.getHeight() + listArr.getHeight() + filterTabHeight));
        verticalAnimation = new TranslateAnimation(0, 0, -filterTabHeight, 0);
    } else {
        listArr.layout(0, (int) (actionBar.getHeight()), 
                listArr.getWidth(), (int) (actionBar.getHeight() + listArr.getHeight()));
        verticalAnimation = new TranslateAnimation(0, 0, filterTabHeight, 0);
    }
    verticalAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    verticalAnimation.setDuration(250);
    animSet = new AnimationSet(false);
    animSet.cancel();
    animSet.reset();
    animSet.setFillAfter(true);
    animSet.addAnimation(verticalAnimation);
    isTabOpen = !isTabOpen;
    listArr.startAnimation(animSet);
}
这是xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.softtechnics.something"
android:id="@+id/coupon_list_layout"
style="@style/FillParent"
android:orientation="vertical" >

<include
    android:id="@+id/filter_tab"
    android:layout_width="match_parent"
    android:layout_height="34dp"
    android:layout_below="@+id/action_bar"
    layout="@layout/filter" />

<com.softtechnics.something.gui.components.ListArr
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/action_bar" />

<com.softtechnics.something.gui.components.ActionBar
    android:id="@+id/action_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true" />

<ProgressBar
    android:id="@+id/progress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:visibility="gone" />

<com.softtechnics.something.gui.components.Footer
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" />

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_below="@id/action_bar"
    android:scaleType="fitXY"
    android:src="@drawable/head_bar_shadow" />


页脚是我的滑动抽屉。谢谢

布局方法不会对视图应用永久性更改。所以下一次当你的布局被更新时,一切都会回来。
更改listView的LayoutParams以应用永久更改并读取。

布局方法不会对视图应用永久更改。所以下一次当你的布局被更新时,一切都会回来。 更改listView的LayoutParams以应用永久更改并读取