【问题标题】:Scale imageview on left to imageview on right's height将左侧的 imageview 缩放到右侧高度的 imageview
【发布时间】:2015-06-24 14:10:06
【问题描述】:

我正在尝试将两个图像视图并排放置,其中左侧的高度与右侧的高度匹配。问题是,图像视图文件的大小比它们在屏幕上的显示要大得多。当我将换行内容分配给右侧的内容时,它会占用所有空间,尽管我希望对其进行缩放,以便为左侧的内容留出足够的空间。我不知道这是否有意义,但这是我的代码。

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:src="@drawable/boombox"
        android:id="@+id/boombox"
        />

    <ImageView
        android:id="@+id/play_stop_button"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_toLeftOf="@id/boombox"
        android:scaleType="fitXY"
        android:src="@drawable/play_stop_button
        />

</RelativeLayout>

【问题讨论】:

    标签: android android-layout android-view android-image android-relativelayout


    【解决方案1】:

    先试放

    android:layout_width="wrap_content"
    android:layout_height="150dp"
    

    在两个图像视图中都有一个固定的图像高度

    【讨论】:

    • 但这不需要与设备相关吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    相关资源
    最近更新 更多