+ 1

Android beginner question.

why i cant move my buttons up.press the link and scroll down to see the question. https://plus.google.com/u/1/107321672913287932096

12th Nov 2017, 2:18 AM
oyl
5 odpowiedzi
+ 11
@Oyl, for vertical LinearLayout, if one nested element's width is match_parent, then it'll occupy the whole width of the parent element. So there will be no place for it's sibling elements. Use the following structure: Horizontal LinearLayout Vertical LinearLayout-1 3 Buttons Vertical LinearLayout-2 3 Buttons Vertical LinearLayout-3 3 Buttons (Maintain open and close tags properly) Here is a sample code for 9 buttons using LinearLayout: https://code.sololearn.com/WMBUJERVYl88/#html It won't run in code playground. You can copy and paste it here: http://labs.udacity.com/android-visualizer/ Note: I used layout_weight property here for my convenience. It can be done in different ways.
12th Nov 2017, 8:26 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
android:gravity should be like this: android:gravity="top|center_horizontal"
12th Nov 2017, 2:23 AM
qwerty
qwerty - avatar
+ 6
What?
12th Nov 2017, 2:15 AM
qwerty
qwerty - avatar
+ 1
sorry edited.u can see now
12th Nov 2017, 2:17 AM
oyl
+ 1
i have tried it.it still remains the same.i want it to align with the 3 buttons on the top
12th Nov 2017, 2:41 AM
oyl