Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9084953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:07:40+00:00 2026-06-16T21:07:40+00:00

I have a card game where the cards are represented as a layout object

  • 0

I have a card game where the cards are represented as a layout object containing a large toggle button with the background image of the card, and textviews representing the rank and suit of the card.

<RelativeLayout
            android:id="@+id/card1">
        <ToggleButton
                android:id="@+id/cardback1" android:background="@drawable/blank_card"  android:checked="false" android:textOff='' android:textOn="HELD" android:textColor="@android:color/holo_red_dark" android:clickable="true" android:enabled="false"/>
        <TextView
                android:id="@+id/rank1"
                android:textColor="@android:color/holo_red_light"
                android:textIsSelectable="false" 
                android:textSize="16dp"
                android:layout_alignParentTop="true" android:layout_marginTop="5dp"
                android:layout_marginLeft="7dp" android:textAlignment="center"/>
        <TextView
                android:id="@+id/suit1" android:text="@string/suit_diamond"
                android:textColor="@android:color/holo_red_light"
                android:textIsSelectable="false" android:typeface="normal"
                android:textSize="24dp"
                android:layout_centerInParent="true"/>
</RelativeLayout>

When redealing cards I wanted to apply a custom animation to show the card as “flipping” which I am doing in a series of Object Animators, rotating on the Y axis
The animators I use are defined like:

 <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
       android:valueFrom="0" android:valueTo="360" android:propertyName="rotationY" > </objectAnimator>

And then I’m animating the RelativeLayout referenced in the layout xml.

  RelativeLayout cardLayout = (RelativeLayout)findViewById(R.id.card1);
 Animator initialAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(cardLayout.getContext(), R.anim.flip360);
    initialAnimator.setTarget(cardLayout);
    initialAnimator.setDuration(1000);
    initialAnimator.start();

However, during the animation, none of the text on the layout is displaying at all. The button image rotates as expected, but the text doesn’t display until the animation has completed.

I was previously using a much simpler animation on the cardLayout, simply scaling on the Y axis to emulate rotation, but it didn’t look very good. However, when using that method, the text still displayed on the card during the animation. Is there something I need to be configuring so the text can be shown on the card and animated along with the image, or do I need to add custom animations to all elements of the card separately?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:07:41+00:00Added an answer on June 16, 2026 at 9:07 pm

    I think stumbled across the answer myself when going through the Android API documentation so I thought I’d just post it here in case someone comes along with the same issue.

    By enabling the drawingCache before calling the animation:

    cardLayout.setDrawingCacheEnabled(true);
    

    I am getting the layout to render as a bitmap before it begins animating, which includes the text contained within the layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails app representing a card game. There are several different types
I have a class like the following representing a game Card. There are more
I am making a card game where the cards are represented as JLabels, having
I am making a card game and I have an activity for discarding cards
I have a simple card game (using 52 cards - no jokers) that I
In Clojure I am building a card game. Cards have a suit and a
I'm writing a little card game in which two players have 4 cards each
I have been developing a game basic card game for Android. At the moment
I am making a card game in ruby. I have the Game class, which
I have a card layout set in my app.js. here's the code; ... launch:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.