【发布时间】:2014-01-25 09:02:07
【问题描述】:
预期布局:
布局渲染:
布局xml来源:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@drawable/banner_back"
/>
<ImageView
android:id="@+id/movie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/back"
android:background="@drawable/banner_background"
/>
<ImageView android:id="@+id/midban"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/back"
android:background="@drawable/banner_mid"
/>
<Button
android:id="@+id/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/banner_right"
/>
<Button
android:id="@+id/fb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/share"
android:layout_alignParentRight="true"
android:background="@drawable/banner_fb"
/>
<Button
android:id="@+id/dummyright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/fb"
android:background="@drawable/layoutslices_new_10"
/>
<Button
android:id="@+id/buy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/fb"
android:layout_toLeftOf="@+id/dummyright"
android:background="@drawable/layoutslices_new_09"
/>
<Button
android:id="@+id/rt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/buy"
android:layout_toLeftOf="@+id/dummyright"
android:background="@drawable/layoutslices_new_11"
/>
<Button
android:id="@+id/imdb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rt"
android:layout_toLeftOf="@+id/dummyright"
android:background="@drawable/layoutslices_new_12"
/>
</RelativeLayout>
</LinearLayout>
所有布局都保持正确的纵横比,但如图所示,标记有问题的按钮被弄乱了。
谁能告诉我我在哪里缺少布局元素,或者我认为我缺少一些基本的东西。
【问题讨论】:
标签: android android-layout android-relativelayout