Android 相对布局渲染不正确(按钮混乱)
预期布局: 呈现的布局: 布局xml源:Android 相对布局渲染不正确(按钮混乱),android,android-layout,android-relativelayout,Android,Android Layout,Android Relativelayout,预期布局: 呈现的布局: 布局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:orientati
<?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>
所有布局都保持了正确的纵横比,但标记有故障的按钮如图所示被弄乱了
有谁能告诉我,我在哪里遗漏了布局元素,或者我认为我遗漏了一些基本的东西 我明白了。您必须使用ImageView而不是按钮。希望这对别人有帮助。最大的浪费时间 即使使用“包裹内容”和“收进背景图像”,也不能低于按钮的特定高度。如果图像的高度低于默认值,则会将图像缩放到默认高度。我不确定这是一个bug还是预期的行为 你也可以在这里查阅: