我有这个问题:
在以下情况下,如何对齐RelativeLayout
以使其左右对齐?
我要删除此空白并在屏幕中对齐蓝色和黄色RelativeLayout
。
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#EAEAEA" >
<RelativeLayout
android:id="@+id/layout_cenas_bottom"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="#FFFF00" >
<Button
android:id="@+id/btnAdicionarCenas"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/title_adicionar_cena"
android:layout_weight="1"
android:background="@drawable/mybutton"
android:textColor="@drawable/mybuttoncolors"
android:textSize="15sp"
android:layout_marginBottom="10dp">
</Button>
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_cenas_conteudo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/layout_cenas_bottom"
android:layout_alignParentTop="true"
android:background="#00FFFF">
<ListView
android:id="@+id/lvCenas"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
</RelativeLayout>
</RelativeLayout>
最佳答案
看起来您的布局是活动布局的一部分。因此,请检查您的主要活动是否具有带有android:paddingXXX
参数的主要布局并将其删除。