我通过扩展相对布局创建了自定义视图,看起来像这样:alt text

视图的布局:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:gravity="center_horizontal">
        <ImageView android:id="@+id/type_picture_preview"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:src="@drawable/type_picture_noimage" android:layout_alignParentRight="true"
            android:paddingTop="15dip" android:paddingRight="15dip" />
        <ImageView android:id="@+id/type_picture_delete" android:src="@drawable/type_picture_delete"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignParentRight="true" />
    </RelativeLayout>
</merge>

我正在努力在一行上获得两个或多个布局。有什么想法我出了什么问题吗?

有帮助吗?

解决方案 2

我必须使用倾角硬编码宽度/高度。

其他提示

采用 LinearLayout 作为带有的容器 orientation="vertical" 并放置你的 RelativeLayouts 里面

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top