Android Question Small cards

Discussion in 'Android Questions' started by Dianzoa, May 23, 2019.

  1. Dianzoa

    Dianzoa Active Member Licensed User

    Hello.
    I have tried the cardview example, works great, but the problem is that the activity in which the panel is created is larger than the panel itself. So for many cards, there is a lot of space in between. It is possible to adapt the activity (parent) to the size only of the panel in which it is loaded?

    Image: If I have mutiple cards results, the space between them is the gray space at the botton of the panel.

    upload_2019-5-23_4-22-8.png
     
  2. DonManfred

    DonManfred Expert Licensed User

    Upload a small project which shows the issue.
     
  3. Dianzoa

    Dianzoa Active Member Licensed User

    This is a variant of the card example from Erel. I just put a little labels, and see how that blue background which is the activity where the card is created occupy much more space than his children panel. I need the activity adapts to the panel children, so the cards are 1 below the other.
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    The layout in the first post is wrong. You are not using anchors correctly. Best to watch the visual designer video tutorial.

    Panel1 shouldn't be anchored to the top only (or change the variant size and make it much shorter).
     
  5. Dianzoa

    Dianzoa Active Member Licensed User

    This is what I get, but I want a smaller card, it's too big for a few info.
    Ok! Thanks, I was drowning in a drop of water lol, just adjust the height of the panel before loading the designer file do the trick

    Code:
    Dim height As Int = 150dip
        
    If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 310dip
        p.SetLayoutAnimated(
    000, Width, height)
        p.LoadLayout(
    "card1")
    Just play around with the height and it works.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice