小编pet*_*umo的帖子

拔下耳机时,wp7 mediaelement会停止

我正在使用媒体元素,当拔下耳机时,我得到一个带有NullReferenceException的mediafailed事件.由于媒体元素流不再起作用,我希望能够区分这种情况并正确处理它.

windows-phone-7

5
推荐指数
1
解决办法
403
查看次数

在Android中保存文件的正确路径

我正在尝试为 Android 编写一个应用程序,我需要从服务器保存 resposne,我设法通过将其保存在此路径中的 txt 文件中来做到这一点:

String path= "/storage/emulated/0/Android/data/com.example.simone.pizzino/files/response.txt"; final File file = new File(path);

在我朋友的手机上测试,他看不到那个路径下的文件夹,他的路径类似于data/data/"packageName",它也不适用于 Android Studio 中的模拟器。我的手机是运行 7.1 库存 rom 的 Nexus 5X。我的朋友使用 6.1 扎根。有没有办法获得应用程序文件夹的动态路径而不必将其声明为常量?

抱歉,如果已经问过这个问题,但我找不到解决我的问题的方法。

android android-file

2
推荐指数
1
解决办法
1万
查看次数

有没有办法在执行时减慢翻译动画的速度?

如何控制动画的速度?翻译动画从下到上,我想在动画执行期间放慢速度.我怎样才能做到这一点?这是我有的:

public void SlideToAbove() {

    Animation slide = null;
    slide = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, 0.0f);

    slide.setDuration(300);
    slide.setFillAfter(true);
    slide.setFillEnabled(true);
    toolBar.startAnimation(slide);

    final Animation finalSlide = slide;
    slide.setAnimationListener(new Animation.AnimationListener() {


        public void onAnimationStart(Animation animation) {
        }


        public void onAnimationRepeat(Animation animation) {
        }


        public void onAnimationEnd(Animation animation) {


            CoordinatorLayout.LayoutParams lp = new CoordinatorLayout.LayoutParams(
                    toolBar.getWidth(), toolBar.getHeight());
            lp.setMargins(0, 0, 0, 0);
            appBarLayout.setLayoutParams(lp);
            finalSlide.setFillAfter(true);

        }

    });
Run Code Online (Sandbox Code Playgroud)

java android android-animation android-coordinatorlayout

1
推荐指数
1
解决办法
389
查看次数