我目前正在使用 xml 为 Activity 创建布局,内容 (FrameLayout) 应该填满整个屏幕。不幸的是,事实并非如此。
只有当我将边距更改为以下时,它才有效:
左:-17dp
右:-19dp
顶部:-16dp
底部:-18dp
但这不是 Intent 。
看起来屏幕有一个基本的填充。
有什么办法可以解决这个问题吗?
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/registration_bg"
android:fillViewport="true"
android:padding="0dp"
tools:context=".MagnetScreen" >
<LinearLayout
android:id="@+id/main_interface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="18dp"
android:layout_marginLeft="17dp"
android:layout_marginRight="19dp"
android:layout_marginTop="16dp"
android:orientation="vertical" >
<TextView
android:id="@+id/registration_headline"
style="@style/registration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/registration_headline"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/extra_large"
android:textStyle="bold" />
</LinearLayout>
最佳答案
FrameLayout 已经填满了整个屏幕,您正在用蓝色背景 (@drawable/registration_bg) 填充它。
屏幕截图中显示的选择是您指定了以下边距的 LinearLayout:
android:layout_marginBottom="18dp"
android:layout_marginLeft="17dp"
android:layout_marginRight="19dp"
android:layout_marginTop="16dp"
关于Android FrameLayout 不填满屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16675107/