因此,我正在为一家餐厅应用程序开发,该餐厅使用grIDvIEw显示项目,每个项目视图都有一个用于购买餐点的按钮,以及3个textvIEw和imagevIEw来显示餐点图像及其名称,详细信息和价格.
此处要做的是将动画翻转到grIDvIEw中的一项,以在背面显示有关餐点的更多详细信息.
Google android开发者网站上的纸牌翻转动画示例在框架布局中使用2个片段来翻转整个片段,我不需要,我只需要翻转一个已经属于grIDvIEw且已经在baseadapter中调用的项目碎片将它们全部保存
我搜索了很多并找到了示例,但是当我尝试实现它们时,我在sdk中找不到“ androID.animation”包,并提到我已经从sdk manger更新了支持库.
请帮我帮我真正需要的朋友.谢谢.
这是该应用程序的一些屏幕截图
和代码.
https://drive.google.com/folder/d/0B9ZvWspyBhx1RUNydFFIei1qdm8/edit
解决方法:
因此,通过本教程,我确实找到了问题的答案
http://icetea09.com/blog/2014/10/21/android-card-flip-animation/
flight_left_in.xml
<set xmlns:androID="http://schemas.androID.com/apk/res/androID"><!-- Rotate. --><objectAnimator androID:valueFrom="-180" androID:valueto="0" androID:propertyname="rotationY" androID:interpolator="@androID:interpolator/accelerate_decelerate" androID:duration="500" /><!-- When the roration reach half of animation, show the card --><objectAnimator androID:valueFrom="0.0" androID:valueto="1.0" androID:propertyname="Alpha" androID:duration="1" androID:startOffset="250"/></set>
flip_right_out.xml
<set xmlns:androID="http://schemas.androID.com/apk/res/androID"><!-- Rotate. --><objectAnimator androID:valueFrom="0" androID:valueto="180" androID:propertyname="rotationY" androID:interpolator="@androID:interpolator/accelerate_decelerate" androID:duration="500" /><!-- Half-way through the rotation, hIDe the front card --><objectAnimator androID:valueFrom="1.0" androID:valueto="0.0" androID:propertyname="Alpha" androID:startOffset="250" androID:duration="1" /></set>
fav_grID_single.xml
<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:tools="http://schemas.androID.com/tools"androID:layout_wIDth="fill_parent"androID:layout_height="fill_parent"androID:orIEntation="horizontal"androID:padding="10dp"androID:paddingBottom="@dimen/activity_vertical_margin"androID:paddingleft="@dimen/activity_horizontal_margin"androID:paddingRight="@dimen/activity_horizontal_margin"androID:paddingtop="@dimen/activity_vertical_margin" ><linearLayout androID:ID="@+ID/fav_grID_single_Front" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:background="@drawable/vIEw_dropshadow" > <relativeLayout androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:background="@drawable/rounded_corner" androID:padding="10dp" androID:paddingBottom="@dimen/activity_vertical_margin" androID:paddingleft="@dimen/activity_horizontal_margin" androID:paddingRight="@dimen/activity_horizontal_margin" androID:paddingtop="@dimen/activity_vertical_margin" > <ImageVIEw androID:ID="@+ID/fav_grID_image" androID:layout_wIDth="312dp" androID:layout_height="212dp" androID:padding="10dp" /> <TextVIEw androID:ID="@+ID/fav_grID_detialsText" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_below="@+ID/fav_grID_nameText" androID:padding="10dp" androID:text="ههههههههههههههههههههههههههههه" androID:textcolor="#111" androID:textSize="17dp" /> <TextVIEw androID:ID="@+ID/fav_grID_priceText" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignBaseline="@+ID/fav_grID_buybutton" androID:layout_alignBottom="@+ID/fav_grID_buybutton" androID:layout_alignRight="@+ID/fav_grID_nameText" androID:padding="5dp" androID:text="500 SDG" androID:textcolor="#111" androID:textSize="18dp" /> <TextVIEw androID:ID="@+ID/fav_grID_nameText" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_alignleft="@+ID/fav_grID_detialsText" androID:layout_below="@+ID/fav_grID_image" androID:layout_marginleft="18dp" androID:padding="5dp" androID:text="الاسم" androID:textcolor="#111" androID:textSize="25dp" androID:textStyle="bold" /> <ratingbar androID:ID="@+ID/fav_ratingbar" androID:layout_wIDth="260dp" androID:layout_height="wrap_content" androID:layout_alignleft="@+ID/fav_grID_detialsText" androID:layout_below="@+ID/fav_grID_detialsText" androID:paddingleft="10dp" /> <button androID:ID="@+ID/fav_grID_buybutton" androID:layout_wIDth="50dp" androID:layout_height="50dp" androID:layout_alignleft="@+ID/fav_grID_nameText" androID:layout_below="@+ID/fav_ratingbar" androID:background="@drawable/buy" androID:padding="5dp" androID:textSize="0dp" /> </relativeLayout></linearLayout><linearLayout androID:ID="@+ID/fav_grID_single_Back" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:Alpha="0" androID:background="@drawable/vIEw_dropshadow" androID:orIEntation="horizontal" > <relativeLayout androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:background="@drawable/rounded_corner" androID:padding="10dp" androID:paddingBottom="@dimen/activity_vertical_margin" androID:paddingleft="@dimen/activity_horizontal_margin" androID:paddingRight="@dimen/activity_horizontal_margin" androID:paddingtop="@dimen/activity_vertical_margin" > <TextVIEw androID:ID="@+ID/fav_grID_morespaText" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:padding="5dp" /> <TextVIEw androID:ID="@+ID/fav_grID_morenameText" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_below="@+ID/fav_grID_morespaText" androID:padding="5dp" androID:text="الاسم" androID:textcolor="#111" androID:textSize="25dp" androID:textStyle="bold" /> <TextVIEw androID:ID="@+ID/fav_grID_moreDetialsText" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_below="@+ID/fav_grID_morenameText" androID:padding="5dp" androID:text="التفاصيل" androID:textcolor="#111" androID:textSize="20dp" /> </relativeLayout></linearLayout><button androID:ID="@+ID/fav_grID_flipbutton" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParentRight="true" androID:layout_alignParenttop="true" androID:background="@drawable/info3" /></relativeLayout>
FavGrID.java
final button info = (button) grID.findVIEwByID(R.ID.fav_grID_flipbutton); info.setonClickListener(new OnClickListener() { public voID onClick(VIEw arg0) { setRightOut = (AnimatorSet) AnimatorInflater.loadAnimator(context, R.animator.flip_right_out); setleftIn = (AnimatorSet) AnimatorInflater.loadAnimator(context, R.animator.flight_left_in); VIEw v = parent.getChildAt(Integer.parseInt(buy.getText().toString())); imgFront = (linearLayout)v.findVIEwByID(R.ID.fav_grID_single_Front); imgBack = (linearLayout)v.findVIEwByID(R.ID.fav_grID_single_Back); if(!isBackVisible){ setRightOut.setTarget(imgFront); setleftIn.setTarget(imgBack); setRightOut.start(); setleftIn.start(); isBackVisible = true; } else{ setRightOut.setTarget(imgBack); setleftIn.setTarget(imgFront); setRightOut.start(); setleftIn.start(); isBackVisible = false; } } });
总结 以上是内存溢出为你收集整理的android-GridView中一项的卡片翻转动画全部内容,希望文章能够帮你解决android-GridView中一项的卡片翻转动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)