I'm developing an android calendar app so I need to align the days in a grid-like style. I'm using the API Level 8 so I need to align them by margins. But when switching to Bigger screens the numbers get to the left of screen and do not cover the whole screen.(I know that is because I use dp as a unit for my margin-left). Is there something like CSS % (percent) in Android Layouts?
Asked
Active
Viewed 82 times
0
-
Use android:width="fill_parent" if you want to fill the screen (or whatever the layout the element is in) – Vic Vuci Sep 06 '12 at 16:46
-
@Vee I have updated the question.. That is not what I want – Miro Markaravanes Sep 06 '12 at 17:12
2 Answers
1
Try this
android:layout_weight="1"
on each element in that section. It should space evenly.

Vic Vuci
- 6,993
- 6
- 55
- 90
0
It's weight
attribute for views inside LinearLayout
. Here is a good explanation what it means. But you can use it only to set view sizes, not margins. However you can put your view into RelativeLayout
, place this layouts to take all available screen width and set attribute centerInParent=true
in your view.

Community
- 1
- 1

amukhachov
- 5,822
- 1
- 41
- 60
-
thx but that isn't my problem. I have edited the question. Please see the updated question! – Miro Markaravanes Sep 06 '12 at 17:12