Lisa Anne
Lisa Anne

Reputation: 4595

Layout margin apparently not working on smaller devices

Please have a look at these pictures.

As you can see there is no margin in the smaller one !!!

Please what am I doing wrong???

enter image description here

enter image description here

Here is a piece of the Layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/general_layout_margin"
android:gravity="center_vertical"
android:orientation="horizontal" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

other widgets...

I have defined the dimension general_layout_margin in res/values/dimens.xml

I have another dimens.xml in res/values-w820dp BUT I HAVEN'T DEFINED IT THERE.

Please what am I dong wrong???

Thanks!

<resources>
<dimen name="general_layout_margin">16dp</dimen>
</resources>

enter image description here

Upvotes: 0

Views: 148

Answers (1)

random6174
random6174

Reputation: 474

Put the android:layout_margin="@dimen/general_layout_margin" into the inner, vertical layout.

It works and I have still no clue why. Welcome to layouting in Android.

Upvotes: 1

Related Questions