SurfaceView animation only animating half the screen on some devices

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 5

Jul 8, 2015 6:28:02 AM via Website

Hello and thanks for replying if you are interested in helping to troubleshoot an animation I am running into.

I have a surface view that I would liek to zoom into when the app opens and it seems to work on some phones and emulators but not others, I have a git that I can share or just post some of the code...

here is a link to my git for it if you like to see it, its built in Android Studio.

[here is the main activity for the app I perform the animation in on resume][1]

here is the git hub link just add the git hub dot com / part

rperez22/My_Application/blob/updating/app/src/main/java/radical/puzzles/MainActivity.java

Thanks!

  • Forum posts: 5

Jul 9, 2015 11:08:15 PM via Website

        Animation anim = AnimationUtils.loadAnimation(common.context,
            R.anim.intro);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            common.isScreenAnimating = true;
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            common.isScreenAnimating = false;
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    anim.reset();
    RelativeLayout container = (RelativeLayout)getActivity().findViewById(R.id.container);
    container.clearAnimation();
    container.startAnimation(anim);

here is the activity layout

<RelativeLayout xmlns:android="..."
xmlns:tools="..."
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">

<fragment
    android:id="@+id/puzzleFragment"
    android:name="logic.PuzzleFragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:tag="puzzleFragmentTag"
    android:layout_alignParentTop="true"
    tools:layout="@layout/puzzle_layout" />

Here is the fragment layout

<RelativeLayout xmlns:android="..."
xmlns:tools="..."
android:id="@+id/puzzleLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="logic.PuzzleFragment">

<logic.PuzzleSurface
    android:id="@+id/puzzle"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<Button
    android:id="@+id/nextButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:contentDescription="@string/continue_desc"
    android:text="@string/next_image"
    android:visibility="invisible" />

<ImageButton
    android:id="@+id/devartButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:contentDescription="@string/deviantart_link_desc"
    android:scaleType="fitCenter"
    android:src="@mipmap/devart"
    android:visibility="invisible" />

<ImageButton
    android:id="@+id/wordpressButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:contentDescription="@string/wordpress_link_desc"
    android:scaleType="fitCenter"
    android:src="@mipmap/wordpress"
    android:visibility="invisible" />