Android FrameLayout 不填满屏幕

标签 android screen padding fill android-framelayout

我目前正在使用 xml 为 Activity 创建布局,内容 (FrameLayout) 应该填满整个屏幕。不幸的是,事实并非如此。 只有当我将边距更改为以下时,它才有效:
左:-17dp
右:-19dp
顶部:-16dp
底部:-18dp

但这不是 Intent 。 看起来屏幕有一个基本的填充。
有什么办法可以解决这个问题吗?

Screen

<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/

相关文章:

c# - C#中的两种不同的窗体

python - PyAutoGUI 定位命令返回错误的图像识别坐标

android - 是否可以在 android 的同一个选项卡中打开新的 Intent ?

html - css 边距未响应

java - 将谷歌地图( fragment ?)添加到 Activity

android - 如何从代码中引用Android Holo资源?

android - 为什么LiveData在Android Studio中只影响主布局而不影响子布局UI?

android - 应用程序开发 : Project Finalisation & Handover (iOS & Android)

python编码十六进制用00填充每个字符

formatting - Tmux pad 格式字符串