0

I have two bitmaps that I have placed the character at the bottom right corner of the bitmap. However, I see that upon changing container height of the imageview whose android:src equals the bitmap, the character in the bitmap does not appear at the bottom of the imageview. I expect the character to appear at the very bottom of the imageview.

Here is how I define the imageview:

<ImageView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:id="@+id/rolling_monsterview"
        android:elevation="6dp"
        android:adjustViewBounds="true"
        android:src="@drawable/demon_animation_list"

        app:layout_constraintStart_toStartOf="@id/helpery_view"
        app:layout_constraintEnd_toEndOf="@id/t9"
        app:layout_constraintTop_toTopOf="@id/t6"
        app:layout_constraintBottom_toBottomOf="@id/t9"
        />

I expect the character to appear at the bottom right corner of view t9! On one bitmap src the character appears at the right corner of view t9 BUT on the another bitmap src IT DOES NOT!

How can I make sure the character, regardless of bitmap used, always appears at the bottom right corner?

Here are two PNGS that show what I am talking about:

not working here

its working here

I have tried android:scaleType="centerCrop" and yes it does place the character at the bottom right corner of the imageview as it appears in the bitmap png file. But, it seems that I have to adjust the scaletype and png file size depending on the Android device. But, that would just take lots of testing and time! Is there a more straight-forward way of doing this?

1
  • 1
    Did you try android:scaleType="fitEnd"? Commented Oct 14, 2024 at 22:07

1 Answer 1

0

The following works: But you have to include both statements int the xml layout file:

        android:scaleType="fitEnd"
        android:gravity="bottom"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.