Question

so my problem is that layout margin doesn't work when i launch my project on device with droid 2.3. But on 4.0.3 and higher it works. I don't understand where i did a mistake, i have a 2 the same devices(Huawei honor) with different os (GingerBread and ICS) and i really don't get why my layout margins wont work on my gingerBread device. So here are the screenshots:

ICS

GINGERBREAD

XML

<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/app_background" >

<include
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    layout="@layout/layout_pleasewait" />

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:orientation="vertical" >

    <View
        android:id="@+id/divider1"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_marginTop="@dimen/divider_margin"
        android:background="@color/layout_divider_bold" />

    <ExpandableListView
        android:id="@+id/firmsList"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:cacheColorHint="#00000000"
        android:divider="@color/layout_divider"
        android:dividerHeight="1dp"
        android:groupIndicator="@null" >
    </ExpandableListView>
</LinearLayout>

<include
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    layout="@layout/layout_no_internet" />

<include
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    layout="@layout/layout_no_searchresult" />
</ViewFlipper>
Était-ce utile?

La solution

You might want to try padding, similar effect. If it does not work, you can consider to put an extra view with a fixed length. It might not be a good solution, but it should work. Hope it helps.

Autres conseils

For example, if you want put a margin_top you need put android:layout_gravity="top". This work for me. Hope it helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top