android – 相对布局未定义下方

在这是我的布局 XML代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">

        <RelativeLayout 
                        android:id="@+id/RelativeLayout01" 
                        android:layout_width="wrap_content" 
                        android:layout_height="wrap_content">   
            <ImageView
                        android:layout_width="fill_parent" 
                        android:layout_height="fill_parent" 
                        android:background="@drawable/default1"
                        android:id="@+id/default1"
                        android:layout_gravity="center"
                        android:scaleType="fitXY">
            </ImageView>

            <ImageView
                        android:layout_marginTop="19dp"
                        android:layout_width="180dp" 
                        android:layout_height="45dp" 
                        android:src="@drawable/fc_postyour_best_score_bg"
                        android:id="@+id/postscore"
                        android:layout_alignParentRight="true"
                        android:scaleType="fitXY">
            </ImageView>   

            <ImageButton
                        android:layout_marginTop="22dp"
                        android:layout_width="35dp" 
                        android:layout_height="35dp" 
                        android:background="@drawable/fctwitterup"
                        android:layout_marginLeft="7dp"
                        android:id="@+id/twitter"
                        android:layout_alignRight="@id/postscore"
                        android:scaleType="fitXY">
            </ImageButton>

            <ImageButton
                        android:layout_marginTop="22dp"
                        android:layout_width="35dp" 
                        android:layout_height="35dp" 
                        android:background="@drawable/fcfacebookdown"
                        android:id="@+id/fb"
                        android:layout_toLeftOf="@id/twitter">
            </ImageButton>

            <ImageButton
                        android:layout_width="160dp" 
                        android:layout_height="40dp" 
                        android:background="@drawable/fsremove_ads_down"
                        android:id="@+id/fsremove_ads_down"                     
                        android:layout_below="@id/postscore"
                        android:layout_alignParentRight="true"
                        android:layout_marginBottom="3dp">
            </ImageButton>

            <ToggleButton 
                         android:id="@+id/fsvibrate_on"
                         android:layout_width="135dip"
                         android:layout_height="35dip"
                         android:textOff=""
                         android:textOn=""
                         android:layout_below="@+id/fsremove_ads_down"
                         android:layout_alignParentRight="true"
                         android:background="@drawable/fsvibrate_on">
            </ToggleButton>

            <ImageButton
                        android:layout_width="210dp" 
                        android:layout_height="60dp" 
                        android:background="@drawable/fcplaydown"
                        android:id="@+id/fcplaydown"
                        android:layout_centerInParent="true">
            </ImageButton>

            <ToggleButton 
                        android:id="@+id/fcsoundondown"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:textOff=""
                        android:textOn=""
                        android:layout_below="@+id/fcplaydown"
                        android:background="@drawable/fcsoundondown">
            </ToggleButton>


        </RelativeLayout>

</LinearLayout>

所以我的问题是@ id / fcsoundondown切换按钮我已经设置在@ id / fcplaydown下面,但是它不会低于指定的按钮,而是在“@ id / postscore”之后出现

解决方法

我不知道为什么会发生这种情况很好解释,但这与你将@ id / fcplaydown ImageButton设置为父级中心,而他的父级是具有wrap_content宽度和高度的RelativeLayout有关,布局只会让人感到困惑.

因此,将RelativeLayout设置更改为match_parent,它将起作用.

<RelativeLayout 
    android:id="@+id/RelativeLayout01" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent">

相关文章

这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...
这篇文章主要介绍“Android岛屿数量算法怎么使用”的相关知识...
本篇内容主要讲解“Android如何开发MQTT协议的模型及通信”,...
本文小编为大家详细介绍“Android数据压缩的方法是什么”,内...