旋转图像浏览而无需剪裁

发布于 2025-02-13 18:07:40 字数 906 浏览 2 评论 0原文

我想动态地改变旋转,我面临的问题。我做了简单的我的问题示例,

“ https://i.sstatic.net/pzmb9.png”时,您可以看到父母切断了我的图像视图的片段。

因为当我设置旋转

xml非常简单

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <ImageView
        android:id="@+id/image"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:rotation="-10"
        android:background="@color/teal_200"
        android:src="@mipmap/ic_launcher" />

</LinearLayout>

实际上我希望我的图片扩展而不是超越imageview的边界 我试图找到解决方案,但所有这些都没有解决我的问题 映像我想如何看到它

I want to change rotation dynamically, bud i faced with the problem. I did simple code example of my problem

as you can see parent cuts off piece of my image view when i set rotate

click here to see emulator screen

xml very simple

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <ImageView
        android:id="@+id/image"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:rotation="-10"
        android:background="@color/teal_200"
        android:src="@mipmap/ic_launcher" />

</LinearLayout>

Actually I want my picture to scale and not go beyond the boundaries of the ImageView
I tried to find solution, but all of them didn't resolve my problem
image how i want to see it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谈情不如逗狗 2025-02-20 18:07:40

我建议将父级布局用于ImageView并设置背景:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/teal_200">

        <ImageView
            android:id="@+id/image"
            android:padding="8dp"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:rotation="-10"
            android:src="@mipmap/ic_launcher" />

    </FrameLayout>

</LinearLayout>

希望它有帮助!

I suggest to use parent layout for ImageView and set background:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/teal_200">

        <ImageView
            android:id="@+id/image"
            android:padding="8dp"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:rotation="-10"
            android:src="@mipmap/ic_launcher" />

    </FrameLayout>

</LinearLayout>

Hope it helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文