Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRichard Chance
Courses Plus Student 311 PointsCannot get my text formatted and + my app will not display "Shake for prediction".
Cannot get my text (It is certain+other text) to stay in the middle of the crystal ball. I have followed all directions and nothing i do seems to resolve issue. Also when i run my app on my own device and others the (shake for prediction) text only displays after you shake it. Any advice or help would be appreciated.
1 Answer
cbcbcb
16,560 PointsOkay. Well it looks like below your question it is saying Linear Layout. So that tells me you're using a LinearLayout. And you've stated that your text isn't staying in the middle.
The main difficulty I'm going to have providing you with an accurate answer is that I don't know whether your LinearLayout's orientation attribute's value is set to either "horizontal" or "vertical" therefore I don't know whether you should focus on adjusting your layout width or your layout height attribute's value ( and or margins ).
It sounds like you're concatenating two instances of type String as well. The main difficulty I'm going to have there is not whether you have an instance of a TextView...( because I will assume that you do although I guess if you're using an EditText field instead it wouldn't matter but you should use a TextView here.)... but what is encapsulating your TextView's dimension's and if wrapped in another type of View object then what is encapsulating its dimensions( width,height,margin, etc ) as well.
Then after discovering this would lead to the question what values are you passing to each respective container's properties related to its own immediate container.Are you making use of the minWidth and minHeight property to allow for the TextView to not adjust its location on the screen as soon you pass the new String object instead of it now having to dynamically change its position to make room for the text whenever you call the object's setText( "a" + "b" )?
Do you know what the possible values are for that TextView's value of type String beforehand?
If you do know what your possibilities are for the TextView's value then are you creating constants by placing them in the Strings.xml file?
If so then you know the maximum amount of possible characters which relate to the maximum width of the object so therefore are you making use of the maxLength attribute by setting its value accordingly?