2010-09-29 22 views
2

想要模拟滑动动画。想法是当按下按钮时,使用id searchForm滑动并滑动tablelayout,以便我可以使用多余空间作为列表。我设法效果基本show的searchForm和按钮,列表似乎是可见的,但在这之后我不能按一下按钮,这里的负责的效果基本show animatio代码:TranslateAnimation结束后Button不工作

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")); 

这里是具有视图元素的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> 

回答

6

我相信,这是动画的意见没有实际移动的X,Y点,但你只是直观地看到通过动画的运动。该意见实际上仍然在原来的位置

see my question

也许将在该位置的GONE视图在您的动画结束时,当动画结束可见性改变,以VISIBLE。它会好像实际上移动了,并且任何对视图的操作(如按钮上的单击事件)都可以用来做你想做的事

+0

你是什么意思?在XML文件中? – Maxrunner 2010-09-30 00:04:40

+0

是放置一个按钮或您想要的任何视图(以xml格式)您的动画的目标位置。一旦动画结束,使按钮可见,所以用户可以点击它 – binnyb 2010-09-30 01:32:33

+0

我设法使这项工作,但动画结束时,闪烁效果似乎应用于按钮。 – Maxrunner 2010-09-30 09:46:59