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 7676867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:17:43+00:00 2026-05-31T17:17:43+00:00

I have an Android app which calculates poker odds ( Shufflebot if you’re interested).

  • 0

I have an Android app which calculates poker odds (Shufflebot if you’re interested). It displays cards on the screen that need to be big enough to tap on. A card is rendered by a CardView class and declared in the layout like so:

<com.shufflebot.view.CardView style="@style/CardView"
    android:id="@+id/flop1"></com.shufflebot.view.CardView>

The corresponding “CardView” style is declared in a res/values/styles.xml.

<style name="CardView">
    <item name="android:layout_width">40dp</item>
    <item name="android:layout_height">56dp</item>
    <item name="android:layout_marginRight">1dp</item>
</style>

The CardView paints into whatever dimensions it is given. There is a lot of empty space when the app runs on a tablet so I’d like to make use of it by making the cards bigger and therefore easier to tap on.

Is it possible to define an alternative styles.xml to do this? e.g. could I define a res/values-xlarge/styles.xml (for pre Android 3.2) and a res/values-sw800dp/styles.xml where I can define an alternative version of my style? Better yet, can this file just contain the one modified style while Android goes to the original styles.xml for the other values?

When I attempt this in Eclipse I see red underlines suggesting to me that this is not supported.

The alternative is that I can define multiple versions of cards.xml, e.g. layout-xlarge/cards.xml but this seems like a lot of maintenance overhead given that the rest of the layout is the same and it’s just the size of one element that needs to change.

So what is the best way of scaling one but not all elements like this?

  • 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-05-31T17:17:45+00:00Added an answer on May 31, 2026 at 5:17 pm

    I found the answer myself almost as an afterthought while looking at something else. I isolated the element which has the different style according to different screensizes, i.e. I create a card.xml in each different layout that it applies to:

    <?xml version="1.0" encoding="utf-8"?>
    <com.shufflebot.view.CardView xmlns:android="http://schemas.android.com/apk/res/android"
        style="@style/CardViewLarge" >
    </com.shufflebot.view.CardView>
    

    and

    <?xml version="1.0" encoding="utf-8"?>
    <com.shufflebot.view.CardView xmlns:android="http://schemas.android.com/apk/res/android"
        style="@style/CardView" >
    </com.shufflebot.view.CardView>
    

    Then I replace instances of in my layouts with statements:

    <include android:id="@+id/river" layout="@layout/card" />
    

    This obviously wouldn’t work if the cards had attributes other than the id which were different but that isn’t the case for me. And it means that the same handful of layouts can serve different screen sizes.

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

Sidebar

Related Questions

I have an android app for which i need to ensure that it has
I have an Android app that I had working a few months ago which
I have a problem that I want to create an Android App which captures
I have an android app which runs a foreground service and while that service
I have an android app which runs mediaplayer.It works fine my problem is that
I have an android app which has native code. The native code needs to
I have an android app which let the user to submit a form ,
I have an Android app which is crashing on some phones, and not on
I have an android app which gives the user the option of loading a
I have an Android app which includes an activity called Help This uses a

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.