【问题标题】:Layout margins doesnt work on android 2.3.3布局边距在 android 2.3.3 上不起作用
【发布时间】:2013-10-20 11:04:04
【问题描述】:

所以我的问题是,当我在使用 droid 2.3 的设备上启动我的项目时,布局边距不起作用。但在 4.0.3 及更高版本上它可以工作。我不明白我在哪里做错了,我有两个相同的设备(华为荣誉)但操作系统不同(GingerBread 和 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>

【问题讨论】:

    标签: android android-linearlayout margins


    【解决方案1】:

    您可能想尝试填充,类似的效果。如果不行,可以考虑多放一个固定长度的view。这可能不是一个好的解决方案,但它应该有效。希望对您有所帮助。

    【讨论】:

    • 我不知道为什么,但它的 wotks!
    【解决方案2】:

    例如,如果你想放置一个margin_top,你需要放置android:layout_gravity="top"。这对我有用。希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2014-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-05
      • 2013-11-23
      • 2012-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多