- Is it possible to center an image with an animation from an XML file?
- <?xml version="1.0" encoding="utf-8"?>
- <translate
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromXDelta="0%"
- android:toXDelta="-50%p"
- android:fromYDelta="0%"
- android:toYDelta="50%p"
- android:duration="1000"
- android:fillEnabled="false"
- android:fillAfter="true">
- </translate>
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/board_layout"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/background"
- android:orientation="vertical">
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_margin="100dp"
- android:orientation="vertical">
- <ImageView
- android:id="@+id/cardsPileImage"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:src="@drawable/back"
- android:layout_gravity="right"
- android:layout_marginTop="10dp"
- android:layout_marginRight="10dp"
- android:adjustViewBounds="true">
- </ImageView>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_gravity="center"
- android:gravity="center">
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/round_button"
- android:paddingLeft="60dp"
- android:paddingRight="60dp"
- android:textSize="25dp"
- android:text="@string/start_game"
- android:onClick="startGame">
- </Button>
- </LinearLayout>
- <ImageView
- android:id="@+id/discardPileImage"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:src="@drawable/back"
- android:layout_gravity="right"
- android:layout_marginTop="10dp"
- android:layout_marginRight="10dp"
- android:adjustViewBounds="true">
- </ImageView>
- </LinearLayout>
- </LinearLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/board_layout"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#FFFFFF"
- android:orientation="vertical">
- <ImageView
- android:id="@+id/cardsPileImage"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:src="@drawable/icon"
- android:layout_gravity="right"
- android:layout_marginTop="110dp"
- android:layout_marginRight="10dp"
- android:layout_marginLeft="10dp">
- </ImageView>
- <Button
- android:layout_below="@+id/cardsPileImage"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/icon"
- android:id="@+id/backButton"
- android:paddingLeft="60dp"
- android:paddingRight="60dp"
- android:textSize="25dp"
- android:text="Start Game"
- android:onClick="startGame">
- </Button>
- <ImageView
- android:id="@+id/discardPileImage"
- android:layout_below="@+id/backButton"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:src="@drawable/icon"
- android:layout_gravity="right"
- android:layout_marginTop="10dp"
- android:layout_marginRight="10dp"
- android:adjustViewBounds="true">
- </ImageView>
- </RelativeLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/board_layout"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#FFFFFF">
- <RelativeLayout
- android:layout_height="fill_parent"
- android:layout_width="fill_parent"
- android:layout_margin="100dp"
- android:gravity="center"
- android:layout_gravity="center">
- <ImageView
- android:id="@+id/cardsPileImage"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/icon"
- android:layout_gravity="right"
- android:layout_alignParentRight="true"
- >
- </ImageView>
- <Button
- android:layout_below="@+id/cardsPileImage"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/icon"
- android:id="@+id/backButton"
- android:layout_centerInParent="true"
- android:textSize="20dp"
- android:layout_margin="10dp"
- android:text="Start Game"
- android:onClick="startGame">
- </Button>
- <ImageView
- android:id="@+id/discardPileImage"
- android:layout_below="@+id/backButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/icon"
- android:layout_gravity="right"
- android:layout_alignParentRight="true"
- >
- </ImageView>
- </RelativeLayout>
- </LinearLayout>