【问题标题】:SlidingDrawer rearanges the main layout when openedSlidingDrawer 打开时重新排列主布局
【发布时间】:2012-12-29 10:59:42
【问题描述】:

我的应用程序中有一个小动画,最后它会更改 ListView 的位置参数,即它比启动时低一点(它以全屏方式启动,按下按钮后,它会向下滑动一点显示它下面的东西,在屏幕的顶部)。通过按下列表,我可以看到它的参数确实发生了变化,并且它的位置也确实发生了变化。现在,如果此时 SlidingDrawer 正在打开,则布局将重新排列,列表将返回全屏。这是为什么呢?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.softtechnics.mobuynet"
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.mobuynet.gui.components.ListArr
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/footer"
    android:layout_below="@+id/action_bar">

</com.softtechnics.mobuynet.gui.components.ListArr>

<com.softtechnics.mobuynet.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"
    style="@style/WrapContent"
    android:layout_centerInParent="true"
    android:visibility="gone" />

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

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="113dp"
    android:layout_alignParentBottom="true"
    android:visibility="invisible" />

Footer 是我的滑动抽屉。 谢谢!

【问题讨论】:

    标签: android animation layout slidingdrawer


    【解决方案1】:

    您必须在动画结束时更改列表视图属性。此外,您应该记住此视图的实际状态并在 onResume 方法中对其进行更新。

    【讨论】:

    • 列表视图的动画没问题。我确实更改了属性。但之后,如果用户打开抽屉,则 listView 会弹回来。如果我不打开抽屉,那一切都好。
    • 您能粘贴更多代码吗?那我大概就能找到bug了
    猜你喜欢
    • 2011-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多