Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Angle value changes in RecyclerView #26

@NayMak

Description

@NayMak

In my RecyclerView, every item uses this XML:

<?xml version="1.0" encoding="utf-8"?>
<com.github.florent37.diagonallayout.DiagonalLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/diagonal_container_left"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:diagonal_direction="right"
    app:diagonal_position="left">

    <com.github.florent37.diagonallayout.DiagonalLayout
        android:id="@+id/diagonal_container_right"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:diagonal_direction="right"
        app:diagonal_position="right">

        <ImageView
            android:id="@+id/img"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            app:type="image" />

    </com.github.florent37.diagonallayout.DiagonalLayout>
</com.github.florent37.diagonallayout.DiagonalLayout>

I set DiagonalLayout angles simply like that in my Adapter (according to the item's position):

if (getAdapterPosition() == 0) {
        diagonalContainerRight.setAngle(10);
} else if (getAdapterPosition() == getItemCount() - 1) {
        diagonalContainerLeft.setAngle(10);
} else {
        diagonalContainerLeft.setAngle(10);
        diagonalContainerRight.setAngle(10);
}

And here is the result:

screenshot_1538731876

Everything on this screenshot is 10 degrees rotated.

However, as you can see, there is a problem that happens only when I use DiagonalLayout in RecyclerView items : angles are not equals.

Images and both red and green rectangles should all be parallels, but it seems that DiagonalLayout angle changes when it is used in a list.

Is there a way to resolve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions