Reputation: 95
As stated in title, my question is why is an image in ImageView shown as a dot in the center. Here is the image that shows what I mean by "dot in the center": 1
This bug is exposed only on Lenovo tablet running Android 8.1.0. On all emulators and other devices everything is working perfectly fine. Here is part of xml and Java code where I'm setting image.
<androidx.cardview.widget.CardView
android:id="@+id/pet_card_view"
android:layout_width="@dimen/card_view_width"
android:layout_height="@dimen/card_view_height"
android:layout_marginStart="@dimen/margin_left_create_marker"
android:layout_marginTop="16dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/corner_radius"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.cardview.widget.CardView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
app:cardCornerRadius="250dp">
<ImageView
android:id="@+id/pet_picture"
android:layout_width="@dimen/pet_picture_width"
android:layout_height="@dimen/pet_picture_height"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"/>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
markerViewModel.getChosenPicture().observe(getViewLifecycleOwner(), uri -> {
if (uri != null) {
binding.petPicture.setImageURI(uri);
petPicture = uri;
}
});
Upvotes: 1
Views: 99
Reputation: 16709
Your app:cardCornerRadius
is taking up all the space. Make it 25dp or less and you should start seeing something.
Upvotes: 2