[英]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.