工程发布到Android后ulead gif animatorr出现问题?怎么解决??

在 SegmentFault,学习技能、解决问题
每个月,我们帮助 1000 万的开发者解决各种各样的技术问题。并助力他们在技术能力、职业生涯、影响力上获得提升。
问题对人有帮助,内容完整,我也想知道答案
问题没有实际价值,缺少关键内容,没有改进余地
使用属性动画遇到异常以下是我的代码,点击一个View然后这个View执行一个高度变化的动画。但是动画没有按照预期出现。加上LOG以后发现动画的回调只调了两次,而且返回的值是最大值。各路大神求解!
public void onClick(View v) {
switch (v.getId()) {
case R.id.product_item_top_rl:
startAnimation(v);
private void startAnimation(final View v) {
int height = v.getHeight();
ValueAnimator va = ValueAnimator.ofInt(0, height);
va.setDuration(1000);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Log.d(TAG, "animation : " + animation.getAnimatedValue());
v.getLayoutParams().height = (Integer) animation.getAnimatedValue();
v.requestLayout();
va.start();
D/ChooseProductFragment: animation : 150 D/ChooseProductFragment: animation : 150
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
问题解决了。是因为我昨天为了用espresso做UI自动化测试,在设置里面关闭了“窗口动画缩放”,“过度动画缩放”,“动画程序时长调整”这三个动画。重新开放这些动画就正常了。
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
你没有指定动画的循环次数和方式,应该加上
//无限循环
va.setRepeatCount(ValueAnimator.INFINITE);
//从头开始动画
va.setRepeatMode(ValueAnimator.RESTART);
同步到新浪微博
分享到微博?
关闭理由:
删除理由:
忽略理由:
推广(招聘、广告、SEO 等)方面的内容
与已有问题重复(请编辑该提问指向已有相同问题)
答非所问,不符合答题要求
宜作评论而非答案
带有人身攻击、辱骂、仇恨等违反条款的内容
无法获得确切结果的问题
非开发直接相关的问题
非技术提问的讨论型问题
其他原因(请补充说明)
我要该,理由是:
在 SegmentFault,学习技能、解决问题
每个月,我们帮助 1000 万的开发者解决各种各样的技术问题。并助力他们在技术能力、职业生涯、影响力上获得提升。用Unity和Android交互出现一个问题,请大家看看【unity3d吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:86,322贴子:
用Unity和Android交互出现一个问题,请大家看看收藏
用Eclipse写了一个Android程序,导出jar文件,然后放在Unity里。生成APK文件的时候出现了下面的错误,求大神帮忙看一下。。Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.F:\adt-bundle-windows-x86-\sdk\build-tools\android-4.4W\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "F:/adt-bundle-windows-x86-/sdk/platforms/android-20\android.jar" -F bin/resources.ap_stderr[res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.]stdout[Configurations: (default) v11 v14 hdpi mdpi xhdpi xxhdpiFiles:
drawable\app_icon.png
Src: () res\drawable\app_icon.png
drawable\ic_launcher.png
Src: (hdpi) res\drawable-hdpi\ic_launcher.png
Src: (mdpi) res\drawable-mdpi\ic_launcher.png
Src: (xhdpi) res\drawable-xhdpi\ic_launcher.png
Src: (xxhdpi) res\drawable-xxhdpi\ic_launcher.png
layout\main.xml
Src: () res\layout\main.xml
values\strings.xml
Src: () res\values\strings.xml
values\styles.xml
Src: () res\values\styles.xml
Src: (v11) res\values-v11\styles.xml
Src: (v14) res\values-v14\styles.xml
AndroidManifest.xml
Src: () AndroidManifest.xmlResource Dirs:
Type drawable
drawable\app_icon.png
Src: () res\drawable\app_icon.png
drawable\ic_launcher.png
Src: (hdpi) res\drawable-hdpi\ic_launcher.png
Src: (mdpi) res\drawable-mdpi\ic_launcher.png
Src: (xhdpi) res\drawable-xhdpi\ic_launcher.png
Src: (xxhdpi) res\drawable-xxhdpi\ic_launcher.png
Type layout
layout\main.xml
Src: () res\layout\main.xml
Type values
values\strings.xml
Src: () res\values\strings.xml
values\styles.xml
Src: () res\values\styles.xml
Src: (v11) res\values-v11\styles.xml
Src: (v14) res\values-v14\styles.xmlIncluding resources from package: F:\adt-bundle-windows-x86-\sdk\platforms\android-20\android.jarapplyFileOverlay for drawableapplyFileOverlay for layoutapplyFileOverlay for animapplyFileOverlay for animatorapplyFileOverlay for interpolatorapplyFileOverlay for transitionapplyFileOverlay for xmlapplyFileOverlay for rawapplyFileOverlay for colorapplyFileOverlay for menuapplyFileOverlay for mipmapProcessing image: res\drawable\app_icon.pngProcessing image: res\drawable-hdpi\ic_launcher.pngProcessing image: res\drawable-mdpi\ic_launcher.png
(processed image res\drawable-mdpi\ic_launcher.png: 82% size of source)Processing image: res\drawable-xhdpi\ic_launcher.png
(processed image res\drawable-hdpi\ic_launcher.png: 77% size of source)Processing image: res\drawable-xxhdpi\ic_launcher.png
(processed image res\drawable-xhdpi\ic_launcher.png: 74% size of source)
(processed image res\drawable\app_icon.png: 94% size of source)
(processed image res\drawable-xxhdpi\ic_launcher.png: 72% size of source)
(new resource id app_icon from drawable\app_icon.png #generated)
(new resource id ic_launcher from hdpi\drawable\ic_launcher.png #generated)
(new resource id ic_launcher from mdpi\drawable\ic_launcher.png #generated)
(new resource id ic_launcher from xhdpi\drawable\ic_launcher.png #generated)
(new resource id ic_launcher from xxhdpi\drawable\ic_launcher.png #generated)
(new resource id main from res\layout\main.xml)]在用Eclipse创建Android项目的时候,如果把Minimum Required SDK选择为Android4.0或以上,则不会报错。否则就会报上面的错误。
我也出现这个问题了。。。好悲催。
AndroidManifest.xml
这个XML文件有问题!
我也遇到这个问题了。。。。
这问题…………2楼大神已解
我找到的资料:10、如果Unity打包过程出现类似下面这样的错误提示:
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
X:\Android SDK\adt-bundle-windows-x86-XXXXXX\sdk\build-tools\X.1.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S &res& -I &E:/Android SDK/adt-bundle-windows-x86-XXXXXX/sdk/platforms/android-X\android.jar& -F bin/resources.ap_表示在Android外挂项目里的res文件夹里有的地方的xml设置文件里的设置内容找不到,比如一条设置指向一个名为bnt的png图片文件,但这个图片的名字不是这个。我的解决办法是:把RES文件里面的资料重新合并(我有两个SDK整合,所以出现了这个错误,重新合并之后就没有错误了)
- -不得不说,楼上说的解决办法正是我遇到的问题,只要把原来unity的res文件夹删掉,再重新把eclipse工程里面的res文件夹放过去就好了...,我之前是直接覆盖了的...
很简单,修改AndroidManifest.xml的内容。将如下内容修改成android:theme=&@android:style/Theme.NoTitleBar&android:icon=&@drawable/app_icon&android:label=&@string/app_name&那么res文件夹可以不必导入。
感谢。试了好多其他方法都不行,就你这个完美解决
妈蛋 遇见同样的错误 咋解决啊
unity3d微职位高端培训,随到随学/4对1辅导/闯关式学习;unity3d微职位高端培训,优选名师授课,实时在线答疑,保证学习效果.
最近也遇到这个问题,先顶一个
我 也正在接
android 下打包 没问题 和unity 对接 出现问题 到布局文件的时候
之前也出现过楼上的问题,后来把360关了就可以了,但是后来打包打出来安装不起,怎么回事啊?
jar文件不是用aar文件代替吗
登录百度帐号Android实现输入法弹出时把布局顶上去和登录按钮顶上去的解决方法
转载 &发布时间:日 10:38:51 & 作者:沉水之木
这篇文章主要介绍了Android实现输入法弹出时把布局顶上去和登录按钮顶上去的解决方法,需要的朋友可以参考下
&背景:在写登录界面时,老板就觉得在输入密码的时候谈出来的输入法软键盘把登录按钮遮挡住了(入下图所示,不爽),连输入框都被挡了一半,于是不满意了,要叫我改,于是我看QQ的登录效果,我就去研究了一下,弹出输入法整个布局上来了,终于让老板满意了。
(如上图这样,老板不满意的,呵呵)
1,咱们就解决问题吧。
&&&& 我看了很多博客和问答,很多人都说直接在在AndroidManifest.xml中给这个Activity设置 &activity android:windowSoftInputMode="stateVisible|adjustPan" ...&这样就好使了,这个是否在逗,整个布局向上移动并不明显,反正我的是不好使,不知道那些博主是怎么弄好使的。不过,看评论,也有很多人说不好使。那就做一个大家都好使的代码出来。先看效果。
&&& 哈哈,大家有没有看到,连登录按钮都一起跑上去了,应该是顶上去的。老板再也不用担心登录按钮被覆盖掉了。
&&& 那咱们就上代码啦:代码不多,全在布局上,就可以解决。&&&
&?xml version="1.0" encoding="utf-8"?&
&ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:fillViewport="true"
android:fadeScrollbars="true"&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top|center_horizontal"
android:orientation="vertical"
android:background="@color/red2"
android:visibility="visible"&
&ImageView
&!--这个其实是我放布局中间的控件,我随便写的,放任何控件都可以--&
android:layout_width="200dp"
android:layout_height="160dp"
&/LinearLayout&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:alwaysDrawnWithCache="true"
android:gravity="center|center_horizontal"
android:orientation="vertical"
android:visibility="visible"
android:background="@color/abc_search_url_text_normal"&
android:background="@color/white"
android:layout_width="200dp"
android:layout_height="60dp"
&/LinearLayout&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/cornsilk"
android:gravity="top|center_horizontal"
android:orientation="vertical"
android:visibility="visible"&
android:layout_marginTop="20dp"
android:gravity="center"
android:text="登录"
android:layout_width="200dp"
android:layout_height="50dp" /&
&/LinearLayout&
&/LinearLayout&
&/ScrollView&
& 对上面就是所有视线代码了,外面一个scrollview,包含一个LinearLayout,在中间包含了三个LinearLayout,当然了包含三个什么容器控件都行,但是一定要用权重(layout_weight)来约束,这是重点,我只说了一遍,还有就是LinearLayout内部的布局尽量用wrap_content,即时要固定高度也要适当,调节调节就好了。
使用的时候很简单,就只有上面一段布局,然而根本用不着神马AndroidManifest.xml中给这个Activity设置
&activity android:name=".view.activity.multisend.MultiChatActivity"
android:windowSoftInputMode="stateVisible|adjustResize"/&
对于这段代码,是可以将底部如果有输入框(最好用FrameLayout包裹),可以向上移动的,类似于QQ输入框。可以不用ScrollView而且输入框向上滚动时,整个布局不会向上滚动。
2,最后再提供一个思路,这个思路来自于“卷皮”,卷皮的登录效果,他的设计思路是,在点击EditText输入框的时候,我第一个猜测是:得到了EditText输入焦点,或者是:猜测是监听到键盘弹出的焦点之后,卷皮顶上那个背景就把它慢慢变小隐藏起来,导致下面的两个输入框滚动到顶部去了,就方便用户输入了。这个思路也很好的解决用户直接可以输入的问题。
3,目前很多项目要解决这个问题的方法就是如上面2解决方案所示的,logo逐渐缩小,然后scroll会滚动上去。
csdn这个编辑器越来越烂了,,图片都搞不上来了
布局看看:
&?xml version="1.0" encoding="utf-8"?&
&RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clipToPadding="true"
android:fitsSystemWindows="true"
android:orientation="vertical"&
&ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginTop="80dp"
android:background="@null"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher"/&
&ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:fillViewport="true"
android:scrollbarThumbVertical="@android:color/transparent"
android:scrollbars="vertical"&
&LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginTop="200dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="13dp"&
&ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:src="@drawable/ic_mobile_flag"/&
android:id="@+id/et_mobile"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:hint="请输入用户名"
android:inputType="textVisiblePassword"
android:maxLength="11"
android:singleLine="true"
android:text=""
android:textColor="@color/_9"
android:textColorHint="@color/_9"
android:textSize="14dp"/&
&ImageView
android:id="@+id/iv_clean_phone"
android:layout_width="40dp"
android:layout_height="fill_parent"
android:scaleType="centerInside"
android:src="@drawable/ic_clear"
android:visibility="gone"/&
&/LinearLayout&
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/e"/&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="13dp"&
&ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:src="@drawable/ic_password_flag"/&
android:id="@+id/et_password"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:hint="请输入密码"
android:inputType="textPassword"
android:maxLength="30"
android:singleLine="true"
android:text=""
android:textColor="@color/_9"
android:textColorHint="@color/_9"
android:textSize="14dp"/&
&ImageView
android:id="@+id/clean_password"
android:layout_width="40dp"
android:layout_height="fill_parent"
android:scaleType="centerInside"
android:src="@drawable/ic_clear"
android:visibility="gone"/&
&ImageView
android:id="@+id/iv_show_pwd"
android:layout_width="40dp"
android:layout_height="fill_parent"
android:scaleType="centerInside"
android:src="@drawable/pass_gone"/&
&/LinearLayout&
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/e"/&
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="21dp"
android:background="@drawable/bg_btn_login_selected"
android:text="@string/login"
android:textColor="@color/white"
android:textSize="18dp"/&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"&
android:id="@+id/regist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:text="注册新用户"
android:textColor="#b0b8b2"
android:textSize="14dp"/&
android:id="@+id/forget_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginBottom="10dp"
android:layout_marginLeft="21dp"
android:text="@string/login_forget_pwd"
android:textColor="#b0b8b2"
android:textSize="14dp"/&
&/LinearLayout&
&/LinearLayout&
&/ScrollView&
&LinearLayout
android:id="@+id/service"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp"&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="联系客服"
android:textColor="#b0b8b2"
android:textSize="14dp"/&
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/e"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="关于我们"
android:textColor="#b0b8b2"
android:textSize="14dp"/&
&/LinearLayout&
&/RelativeLayout&
然后java代码是,
private int screenHeight = 0;//屏幕高度
private int keyHeight = 0; //软件盘弹起后所占高度
private float scale = 0.6f; //logo缩放比例
private int height = 0;
private void initView() {
screenHeight = this.getResources().getDisplayMetrics().heightP //获取屏幕高度
keyHeight = screenHeight / 3;//弹起高度为屏幕高度的1/3
* 禁止键盘弹起的时候可以滚动
mScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
mScrollView.addOnLayoutChangeListener(new ViewGroup.OnLayoutChangeListener() {
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
/* old是改变前的左上右下坐标点值,没有old的是改变后的左上右下坐标点值
现在认为只要控件将Activity向上推的高度超过了1/3屏幕高,就认为软键盘弹起*/
if (oldBottom != 0 && bottom != 0 && (oldBottom - bottom & keyHeight)) {
Log.e("wenzhihao", "up------&" + (oldBottom - bottom));
int dist = mContent.getBottom() -
if (dist & 0) {
ObjectAnimator mAnimatorTranslateY = ObjectAnimator.ofFloat(mContent, "translationY", 0.0f, -dist);
mAnimatorTranslateY.setDuration(300);
mAnimatorTranslateY.setInterpolator(new LinearInterpolator());
mAnimatorTranslateY.start();
RxAnimationUtils.zoomIn(mLogo, 0.6f, dist);
} else if (oldBottom != 0 && bottom != 0 && (bottom - oldBottom & keyHeight)) {
Log.e("wenzhihao", "down------&" + (bottom - oldBottom));
if ((mContent.getBottom() - oldBottom) & 0) {
ObjectAnimator mAnimatorTranslateY = ObjectAnimator.ofFloat(mContent, "translationY", mContent.getTranslationY(), 0);
mAnimatorTranslateY.setDuration(300);
mAnimatorTranslateY.setInterpolator(new LinearInterpolator());
mAnimatorTranslateY.start();
//键盘收回后,logo恢复原来大小,位置同样回到初始位置
RxAnimationUtils.zoomOut(mLogo, 0.6f);
mBtnLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RxKeyboardUtils.hideSoftInput(mContext);
* @param view
public static void zoomIn(final View view, float scale, float dist) {
view.setPivotY(view.getHeight());
view.setPivotX(view.getWidth() / 2);
AnimatorSet mAnimatorSet = new AnimatorSet();
ObjectAnimator mAnimatorScaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.0f, scale);
ObjectAnimator mAnimatorScaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.0f, scale);
ObjectAnimator mAnimatorTranslateY = ObjectAnimator.ofFloat(view, "translationY", 0.0f, -dist);
mAnimatorSet.play(mAnimatorTranslateY).with(mAnimatorScaleX);
mAnimatorSet.play(mAnimatorScaleX).with(mAnimatorScaleY);
mAnimatorSet.setDuration(300);
mAnimatorSet.start();
* @param view
public static void zoomOut(final View view, float scale) {
view.setPivotY(view.getHeight());
view.setPivotX(view.getWidth() / 2);
AnimatorSet mAnimatorSet = new AnimatorSet();
ObjectAnimator mAnimatorScaleX = ObjectAnimator.ofFloat(view, "scaleX", scale, 1.0f);
ObjectAnimator mAnimatorScaleY = ObjectAnimator.ofFloat(view, "scaleY", scale, 1.0f);
ObjectAnimator mAnimatorTranslateY = ObjectAnimator.ofFloat(view, "translationY", view.getTranslationY(), 0);
mAnimatorSet.play(mAnimatorTranslateY).with(mAnimatorScaleX);
mAnimatorSet.play(mAnimatorScaleX).with(mAnimatorScaleY);
mAnimatorSet.setDuration(300);
mAnimatorSet.start();
这段代码大体就是这么实现的,动态处理sroll向上滚动问题,logo动态缩小即可解决
以上所述是小编给大家介绍的Android实现输入法弹出时把布局顶上去和登录按钮顶上去的解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具}

我要回帖

更多关于 animator 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信