我是android开发的新手。我正在为我的 android 应用程序制作 UI。现在,mdpi 屏幕的高度是 480px。所以我将我的 UI 设计为在 mdpi 的屏幕上具有 480px 的高度。但是因为状态栏在设备顶部占用了一些空间,所以我在 RelativeLayout 中的一些 ImageView 是重叠的。如何补偿状态栏占用的空间?因为对于不同的屏幕,状态栏的大小会有所不同,而在平板电脑中,状态栏甚至可能不在顶部。我很困惑,求助!
编辑: XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageView1"
android:clickable="false"
android:contentDescription="@string/p"
android:scaleType="center"
android:src="@drawable/volbar" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:clickable="false"
android:contentDescription="@string/p"
android:scaleType="center"
android:src="@drawable/base" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:contentDescription="@string/p"
android:scaleType="center"
android:src="@drawable/head" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView1"
android:layout_alignParentRight="true"
android:layout_marginBottom="33dp"
android:layout_marginRight="19dp"
android:text="@string/press_to_update" />
<ImageView
android:id="@+id/imageView9"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageView2"
android:clickable="false"
android:contentDescription="@string/p"
android:scaleType="center"
android:src="@drawable/frag1"
/>
</RelativeLayout>