簡體   English   中英

為什么我的relativelayout不填滿屏幕? - android

[英]Why isn't my relativelayout filling the screen? - android

我正在努力弄清楚為什么我的relativelayout屏幕沒有填滿整個屏幕。 我嘗試了很多東西,但是屏幕的水平空間永遠不會出現。 我究竟做錯了什么?

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/splashscreen"
    android:background="@color/splashScreenBackgroundColor"
    >

    <ImageView
        android:id="@+id/imgLogo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:textSize="12sp"
        android:textColor="#454545"
        android:gravity="center_horizontal"
        android:layout_alignParentBottom="true"
        android:text="MyAppName"
        />

</RelativeLayout>

舊名稱已棄用,請將值更改為此值。

android:layout_width="match_parent"
android:layout_height="match_parent"

添加singletop將替換你活動的最后一個實例,所以如果這解決了你的問題,你可能會在某個地方多次實例化你的活動,這就是為什么之前沒有工作的原因。

我想出了一個解決方案。 我將“android:launchMode =”singleTop“”添加到relativelayout,它解決了問題!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM