2

私の問題は、droid 2.3 を搭載したデバイスでプロジェクトを起動すると、レイアウト マージンが機能しないことです。しかし、4.0.3 以降では動作します。どこで間違いを犯したのかわかりません。異なるOS(GingerBreadとICS)を備えた2つの同じデバイス(Huaweiの名誉)があり、レイアウトマージンが私のgingerBreadデバイスで機能しない理由が本当にわかりません。スクリーンショットは次のとおりです。

ICS

ジンジャーブレッド

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>
4

2 に答える 2

2

パディング、同様の効果を試してみてください。うまくいかない場合は、固定長の余分なビューを配置することを検討できます。良い解決策ではないかもしれませんが、うまくいくはずです。それが役に立てば幸い。

于 2013-10-20T11:18:50.330 に答える
2

たとえば、margin_top を置きたい場合は、 put が必要ですandroid:layout_gravity="top"。これは私にとってはうまくいきます。それが役に立てば幸い。

于 2014-04-14T16:16:04.663 に答える