我正在制作一款Android应用程序" Checkers"
我的主要活动是加载一个XML文件,该文件的表格与8X8 imageView的大小相同(所有这些都是方形的,因此它们可以正确地作为一块板装入)
关于代码:如果我有一个imageview的id,我如何在这个imageview上创建另一个imageview(如果重要的话,新的imageview会更小)?
我的第二个问题是:在我的代码中创建了一个新的imageview之后,如何制作动画使其移动到另一个imageView之上?
我的意思是动画的方法得到(ImageView来自,ImageView),并从另一个视图顶部的直线移动(从是一个圆,而是一个正方形,圆小于正方形我希望最后圆圈的中心位于广场的中心)
编辑:
这就是XML:
<TableRow android:id="@+id/Row0" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i00" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> </TableRow> <TableRow android:id="@+id/Row1" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i10" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i11" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i12" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i13" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i14" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i16" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i17" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> </TableRow> <TableRow android:id="@+id/Row2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i20" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i21" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i22" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i23" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i24" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i25" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i26" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i27" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> </TableRow> <TableRow android:id="@+id/Row3" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i30" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i31" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i32" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i33" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i34" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i35" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i36" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i37" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> </TableRow> <TableRow android:id="@+id/Row4" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i40" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i41" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i42" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i43" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i44" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i45" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i46" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i47" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> </TableRow> <TableRow android:id="@+id/Row5" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i50" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i51" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i52" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i53" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i54" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i55" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i56" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i57" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> </TableRow> <TableRow android:id="@+id/Row6" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i60" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i61" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i62" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i63" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i64" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i65" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i66" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i67" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> </TableRow> <TableRow android:id="@+id/Row7" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/i70" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i71" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i72" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i73" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i74" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i75" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> <ImageView android:id="@+id/i76" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/empty" /> <ImageView android:id="@+id/i77" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/button_description" android:src="@drawable/non_play" /> </TableRow> </TableLayout>
我想要一个像以下代码的代码:
ImageView from = get....(R.id.i00); //dont
ImageView to = get...(..i22);
//now i want to make a new ImageView on top of the "from" ,lets call him tempView
and then i want that tempview will animate to "to"
我该怎么做?