• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps I'm having trouble with Constraints

Guitarist

Newbie
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).
 

Attachments

  • ButtonIssueUI.JPG
    ButtonIssueUI.JPG
    44.1 KB · Views: 181
Maybe show us your code?

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!
 

Attachments

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.
 
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.
 
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.

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.
 
Back
Top Bottom