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

Angle value changes in RecyclerView #26

Open
NayMak opened this issue Oct 5, 2018 · 0 comments
Open

Angle value changes in RecyclerView #26

NayMak opened this issue Oct 5, 2018 · 0 comments

Comments

@NayMak
Copy link

NayMak commented Oct 5, 2018

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?

@NayMak NayMak changed the title Angle value changes and is not correct anymore in RecyclerView Angle value changes in RecyclerView Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant