gpt4 book ai didi

android - TranslateAnimation 结束后按钮不起作用

转载 作者:太空狗 更新时间:2023-10-29 16:25:08 27 4
gpt4 key购买 nike

我想模拟一个上滑动画。我的想法是在按下按钮时使用 id searchForm 上滑和下滑表格布局,这样我就可以将额外的空间用于列表。我设法向上滑动 searchForm 和按钮,列表似乎是可见的,但在此之后我无法单击按钮,这是负责向上滑动动画的代码:

TranslateAnimation slide = new TranslateAnimation(0, 0, 0,
-findViewById(R.id.searchForm).getHeight());
slide.setDuration(500);
slide.setFillAfter(true);
findViewById(R.id.searchForm).startAnimation(slide);
findViewById(R.id.listBut).startAnimation(slide);

adapterSearch.add(new NotificationEntry("","444/2010","TEste","Etapa de teste2","2010"));

这是包含 View 元素的 xml:

<TableLayout android:id="@+id/search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:stretchColumns="1">
<TableLayout android:id="@+id/searchForm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:stretchColumns="1">
<TableRow android:paddingTop="5px">
<TextView android:text="Nº Processo:" />
<EditText android:id="@+id/processNr" />
</TableRow>
<View android:id="@+id/View01"
android:layout_width="wrap_content"
android:background="#B5B5B5"
android:layout_height="1px"
android:paddingBottom="2px">
</View>
<TableRow android:paddingTop="5px">
<TextView android:text="Etapa:" />
<EditText android:id="@+id/tasksearch" />
</TableRow>
<View android:id="@+id/View01"
android:layout_width="wrap_content"
android:background="#B5B5B5"
android:layout_height="1px"
android:paddingBottom="2px">
</View>
<TableRow android:paddingTop="5px">
<TextView android:text="Data inicio:"
android:id="@+id/datepick" />
<EditText android:id="@+id/datebegvalue" />
</TableRow>
<View android:id="@+id/View01"
android:layout_width="wrap_content"
android:background="#B5B5B5"
android:layout_height="1px"
android:paddingBottom="2px"
android:paddingTop="5px">
</View>
<TableRow android:paddingTop="5px">
<TextView android:text="Data Fim:"
android:id="@+id/dateendpick" />
<EditText android:id="@+id/dateendvalue" />
</TableRow>
<View android:id="@+id/View01"
android:layout_width="wrap_content"
android:background="#B5B5B5"
android:layout_height="1px"
android:paddingBottom="2px"
android:paddingTop="5px">
</View>
</TableLayout>
<TableLayout android:id="@+id/listBut">
<TableRow android:paddingTop="5px">
<Button android:id="@+id/send"
android:text="Procurar"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</TableRow>
<ListView android:id="@+id/processlistsearch"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</TableLayout>

最佳答案

我相信动画 View 实际上并没有移动它们的 x,y 点,但您只是通过动画直观地看到它们的移动。 View 实际上仍处于原始位置

see my question

也许可以在动画结束的位置放置一个GONE View ,并在动画结束时将可见性更改为VISIBLE。它看起来好像实际上移动了,并且 View 上的任何操作(例如按钮上的单击事件)都可以用来执行您想要的操作

关于android - TranslateAnimation 结束后按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3824340/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com