android – fitsSystemWindows和kitkat上的额外填充

我在一个带有动作栏的活动中有一个ListView,如下所示:
<LinearLayout
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    tools:context=".LauncherActivity"

    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
        <ListView
            android:id="@+id/lvcalendar"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:clipToPadding="false"
            android:fitsSystemWindows="true"


            android:dividerHeight="10dp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:divider="#00ffffff"

            android:scrollbarThumbVertical="@drawable/scrollbarstyle"
            android:layout_gravity="top"
            android:listSelector="@android:color/transparent"
            />
</LinearLayout>

活动主题包括

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

在Kitkat设备下,行为是我想要的:项目底部和顶部都有10dp填充.在kitkat设备上,paddingTop和paddingBottom似乎没有效果,因为ListView的项目在顶部和底部没有10dp填充.

我认为问题出在android:fitsSystemWindows中,因为这个属性似乎设置了必要的填充到视图,因为半透明的装饰,并使android:padding *属性被忽略.

我的问题:无论如何,我可以将android:fitsSystemWindows设置为true并仍然在视图上添加额外的填充?

解决方法

您应该将此属性添加到父视图:
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:context=".LauncherActivity"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...