1. Are you ready for the Galaxy S20? Here is everything we know so far!

I'm having trouble with Constraints

Discussion in 'Android Development' started by Guitarist, Dec 17, 2019.

  1. Guitarist

    Guitarist Newbie
    Thread Starter

    I'm familiar with and can develop with Java but new to Android with my firm. I'm struggling with getting button constraints to work.

    What I have done...
    I've visited and performed multiple tutorials on developer.android.com, performed some tutorials through videos, and read tutorials online about creating UIs. I'm still struggling getting things to align and I'm not sure why. In this case, I cannot get one button to align correctly with the rest of the UI (See attached file: ButtonIssueUI).
     

    Attached Files:


    Advertisement

  2. wseng92

    wseng92 Android Enthusiast

    Maybe show us your code?
     
    Dannydet likes this.
  3. Guitarist

    Guitarist Newbie
    Thread Starter

    Sure, np! There is no Java code so attached is the XML. This will be a learning experience for me. I'm sure it is a lack of understanding on my part. I simply don't know why the drag / drop and anchoring is not working as demonstrated in many online resources.

    I did manage to analyze the XML to see what is going on and I think I'm slowly grasping this issue from that perspective. However, the attributes don't update the positioning either for some reason. Having to code from the XML seems very time consuming, so I wasn't sure if anyone could tell me why the anchoring is not working... knowing very well it's me lacking the knowledge.

    Thanks!
     

    Attached Files:

  4. 23tony

    23tony Well-Known Member

    First off, you can paste the code directly here - just wrap it in [ code ] ... [ /code ] (without the spaces)

    Looking at the XML, I see three elements that are not visible on the screenshot you shared. If that code is what is generating that screen, I would first eliminate the extraneous items. There also are two widget groups that I don't think are being used either.
     
  5. Guitarist

    Guitarist Newbie
    Thread Starter

    23tony:

    Thanks for the reply and comments. I didn't see any code posting icons, so I assumed I couldn't post the code. I did eliminate the widgets. I did find a couple other helps online and reading. I think I'm getting the hang of it. Researched, read and practiced with a number of projects since the last posting, so I'm understanding a little more. It appears that using the XML code is better than trying to interact with the UI Designer.
     
  6. 23tony

    23tony Well-Known Member

    Yeah, I think that's a bit of an oversight on the forum's part - I suspect it's because the code blocks are really only used in the dev sub-forum, but maybe it could be added in a sticky? (I don't remember ever reading one with that note)

    I've found that the best way to get the design I want is to use the UI designer to quickly throw the elements onto the screen, then switch to the XML screen to get it exactly as I want. It's certainly much easier to control the details that way.
     
  7. Deleted User

    Deleted User Guest

    It is in a sticky, but nobody bothers to read it :D;)

    https://androidforums.com/threads/please-read-me-before-posting.987318/

    (How to ask a question in this forum paragraph)
     
Loading...
Similar Threads - I'm having trouble
  1. Tejana Mama84
    Replies:
    2
    Views:
    169
  2. dontpanicbobby
    Replies:
    3
    Views:
    176
  3. Cyberdev
    Replies:
    2
    Views:
    683
  4. 1vryfrustratedwoman
    Replies:
    4
    Views:
    287
  5. LOveWerks
    Replies:
    12
    Views:
    798
  6. Sunlich
    Replies:
    5
    Views:
    1,454
  7. Budrow187
    Replies:
    4
    Views:
    475
  8. lajby95
    Replies:
    3
    Views:
    521
  9. dex2908
    Replies:
    1
    Views:
    1,655
  10. joaquim1
    Replies:
    6
    Views:
    235

Share This Page

Loading...