0

我有三个RelativeLauoutsLinearLayout,我不能让它填充我的模拟器上的整个屏幕?问题是什么?RelativeLayout将不会填满整个屏幕

这里是我的xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
android:orientation="vertical" 
android:layout_height="match_parent"> 


<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.5"> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/letteord" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:src="@drawable/letteord" 
     android:scaleType="centerCrop" 
     android:layout_alignParentEnd="true" /> 

    <Button 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="Let" 
     android:id="@+id/letteOrdbutton" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:textSize="50dp" 
     android:background="#a4000000" 
     android:textColor="#FFFFFF" /> 

</RelativeLayout> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.5"> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/normaleord" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:src="@drawable/normaleord" 
     android:scaleType="centerCrop" 
     android:layout_alignParentEnd="true" /> 

    <Button 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="Normal" 
     android:id="@+id/normaleOrdbutton" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:textColor="#FFFFFF" 
     android:background="#a4000000" 
     android:textSize="50dp" /> 
</RelativeLayout> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.5"> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/svaereord" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:src="@drawable/svaereord" 
     android:scaleType="centerCrop" 
     android:layout_alignParentEnd="true" /> 

    <Button 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="Svær" 
     android:id="@+id/svaereOrdbutton" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:textSize="50dp" 
     android:textColor="#FFFFFF" 
     android:background="#a4000000" /> 
</RelativeLayout> 
</LinearLayout> 

我试图改变与和高度的布局,但它仍然不会填满整个屏幕,你可以在这个截图中看到:

enter image description here

+0

这是一个片段还是活动?你的活动布局中是否有填充? –

+0

这是一个没有填充的片段 – Muddi

+1

但主要的活动布局确实有填充 – Muddi

回答

0

嗯,我在上面的代码中看不到填充或边距。这只是您的xml文件中的部分代码?检查你的主要活动布局,看看是否有任何填充或边距。删除它们,如果有的话它应该可以正常工作。