android - 布局边距不适用于 android 2.3.3

标签 android android-linearlayout margins

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

最佳答案

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

关于android - 布局边距不适用于 android 2.3.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19476626/

相关文章:

Android:JSON 字符串数据与其他字符串比较

Android如何绘制圆形矩形和阴影Layout

android - 从 LinearLayout (Android) 中删除所有 View

css - 我如何摆脱我没有分配的 margin ?

模块之间的 Android Kotlin Compose 编译器版本不匹配

android - 在 Android 上使用 Visual Studio 2015 调试停止工作

java - 使用 GSON 解析带有键和选项卡的 JSON 文件

android - ScrollView 隐藏底部线性布局

matlab - 如何消除子图和周围之间的差距

HTML -- margin-left & -right 不适用于 flexbox